summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-02-08 14:58:39 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-02-17 14:01:45 -0600
commit19da30b980011caaf1f8e658ddfbfc137216ad11 (patch)
tree29a717ee390c36eb6ee364537beeb3e10e7d34b3
parentde3a34fc72ce83d75c84e640a47e1f5cf4b46dbe (diff)
downloadpango-19da30b980011caaf1f8e658ddfbfc137216ad11.tar.gz
Drop pango_shape variants
We don't need 3 different apis for shaping.
-rw-r--r--pango/ellipsize.c8
-rw-r--r--pango/pango-context.c8
-rw-r--r--pango/pango-glyph.h40
-rw-r--r--pango/pango-layout.c2
-rw-r--r--pango/shape.c89
-rw-r--r--tests/test-font.c2
-rw-r--r--tests/testmisc.c2
7 files changed, 32 insertions, 119 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index d7b7fee0..9601945c 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -379,10 +379,10 @@ shape_ellipsis (EllipsizeState *state)
glyphs = state->ellipsis_run->glyphs;
len = strlen (ellipsis_text);
- pango_shape_with_flags (ellipsis_text, len,
- ellipsis_text, len,
- &item->analysis, glyphs,
- state->shape_flags);
+ pango_shape (ellipsis_text, len,
+ ellipsis_text, len,
+ &item->analysis, glyphs,
+ state->shape_flags);
state->ellipsis_width = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
diff --git a/pango/pango-context.c b/pango/pango-context.c
index d5e73cfe..27bb2e00 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -644,9 +644,11 @@ update_metrics_from_items (PangoFontMetrics *metrics,
pango_font_metrics_unref (raw_metrics);
}
- pango_shape_full (text + item->offset, item->length,
- text, text_len,
- &item->analysis, glyphs);
+ pango_shape (text + item->offset, item->length,
+ text, text_len,
+ &item->analysis, glyphs,
+ PANGO_SHAPE_NONE);
+
metrics->approximate_char_width += pango_glyph_string_get_width (glyphs);
}
diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h
index 788cf3cd..a9d5507f 100644
--- a/pango/pango-glyph.h
+++ b/pango/pango-glyph.h
@@ -232,37 +232,23 @@ typedef enum {
PANGO_SHAPE_ROUND_POSITIONS = 1 << 0,
} PangoShapeFlags;
-PANGO_AVAILABLE_IN_ALL
-void pango_shape (const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs);
-
-PANGO_AVAILABLE_IN_1_32
-void pango_shape_full (const char *item_text,
- int item_length,
- const char *paragraph_text,
- int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs);
-
PANGO_AVAILABLE_IN_1_44
-void pango_shape_with_flags (const char *item_text,
- int item_length,
- const char *paragraph_text,
- int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags);
+void pango_shape (const char *item_text,
+ int item_length,
+ const char *paragraph_text,
+ int paragraph_length,
+ const PangoAnalysis *analysis,
+ PangoGlyphString *glyphs,
+ PangoShapeFlags flags);
PANGO_AVAILABLE_IN_1_50
-void pango_shape_item (PangoItem *item,
- const char *paragraph_text,
- int paragraph_length,
- PangoLogAttr *log_attrs,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags);
+void pango_shape_item (PangoItem *item,
+ const char *paragraph_text,
+ int paragraph_length,
+ PangoLogAttr *log_attrs,
+ PangoGlyphString *glyphs,
+ PangoShapeFlags flags);
G_END_DECLS
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 07196fdb..5ca4122b 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3362,7 +3362,7 @@ ensure_tab_width (PangoLayout *layout)
_pango_attr_list_destroy (&tmp_attrs);
item = items->data;
- pango_shape_with_flags (" ", 8, " ", 8, &item->analysis, glyphs, shape_flags);
+ pango_shape (" ", 8, " ", 8, &item->analysis, glyphs, shape_flags);
pango_item_free (item);
g_list_free (items);
diff --git a/pango/shape.c b/pango/shape.c
index 30bceb80..fe291464 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -769,81 +769,6 @@ pango_shape_internal (const char *item_text,
/**
* pango_shape:
- * @text: the text to process
- * @length: the length (in bytes) of @text
- * @analysis: `PangoAnalysis` structure from [func@Pango.itemize]
- * @glyphs: glyph string in which to store results
- *
- * Convert the characters in @text into glyphs.
- *
- * Given a segment of text and the corresponding `PangoAnalysis` structure
- * returned from [func@Pango.itemize], convert the characters into glyphs. You
- * may also pass in only a substring of the item from [func@Pango.itemize].
- *
- * It is recommended that you use [func@Pango.shape_full] instead, since
- * that API allows for shaping interaction happening across text item
- * boundaries.
- *
- * Note that the extra attributes in the @analyis that is returned from
- * [func@Pango.itemize] have indices that are relative to the entire paragraph,
- * so you need to subtract the item offset from their indices before
- * calling [func@Pango.shape].
- */
-void
-pango_shape (const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- pango_shape_full (text, length, text, length, analysis, glyphs);
-}
-
-/**
- * pango_shape_full:
- * @item_text: valid UTF-8 text to shape.
- * @item_length: the length (in bytes) of @item_text. -1 means nul-terminated text.
- * @paragraph_text: (nullable): text of the paragraph (see details).
- * @paragraph_length: the length (in bytes) of @paragraph_text. -1 means nul-terminated text.
- * @analysis: `PangoAnalysis` structure from [func@Pango.itemize].
- * @glyphs: glyph string in which to store results.
- *
- * Convert the characters in @text into glyphs.
- *
- * Given a segment of text and the corresponding `PangoAnalysis` structure
- * returned from [func@Pango.itemize], convert the characters into glyphs.
- * You may also pass in only a substring of the item from [func@Pango.itemize].
- *
- * This is similar to [func@Pango.shape], except it also can optionally take
- * the full paragraph text as input, which will then be used to perform
- * certain cross-item shaping interactions. If you have access to the broader
- * text of which @item_text is part of, provide the broader text as
- * @paragraph_text. If @paragraph_text is %NULL, item text is used instead.
- *
- * Note that the extra attributes in the @analyis that is returned from
- * [func@Pango.itemize] have indices that are relative to the entire paragraph,
- * so you do not pass the full paragraph text as @paragraph_text, you need
- * to subtract the item offset from their indices before calling
- * [func@Pango.shape_full].
- *
- * Since: 1.32
- */
-void
-pango_shape_full (const char *item_text,
- int item_length,
- const char *paragraph_text,
- int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- pango_shape_with_flags (item_text, item_length,
- paragraph_text, paragraph_length,
- analysis,
- glyphs,
- PANGO_SHAPE_NONE);
-}
-
-/**
- * pango_shape_with_flags:
* @item_text: valid UTF-8 text to shape
* @item_length: the length (in bytes) of @item_text.
* -1 means nul-terminated text.
@@ -872,13 +797,13 @@ pango_shape_full (const char *item_text,
* Since: 1.44
*/
void
-pango_shape_with_flags (const char *item_text,
- int item_length,
- const char *paragraph_text,
- int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+pango_shape (const char *item_text,
+ int item_length,
+ const char *paragraph_text,
+ int paragraph_length,
+ const PangoAnalysis *analysis,
+ PangoGlyphString *glyphs,
+ PangoShapeFlags flags)
{
pango_shape_internal (item_text, item_length,
paragraph_text, paragraph_length,
diff --git a/tests/test-font.c b/tests/test-font.c
index 2eef4396..3d162945 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -202,7 +202,7 @@ test_extents (void)
items = pango_itemize (context, str, 0, strlen (str), NULL, NULL);
glyphs = pango_glyph_string_new ();
item = items->data;
- pango_shape (str, strlen (str), &item->analysis, glyphs);
+ pango_shape (str, strlen (str), NULL, 0, &item->analysis, glyphs, PANGO_SHAPE_NONE);
pango_glyph_string_extents (glyphs, item->analysis.font, &ink, &log);
g_assert_cmpint (ink.width, >=, 0);
diff --git a/tests/testmisc.c b/tests/testmisc.c
index c1eadc58..f71932fd 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -404,7 +404,7 @@ test_fallback_shape (void)
g_clear_object (&item->analysis.font);
glyphs = pango_glyph_string_new ();
- pango_shape_full (text + item->offset, item->length, NULL, 0, &item->analysis, glyphs);
+ pango_shape (text + item->offset, item->length, NULL, 0, &item->analysis, glyphs, PANGO_SHAPE_NONE);
for (int i = 0; i < glyphs->num_glyphs; i++)
{