diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-07-07 12:08:41 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-07-12 09:31:50 -0400 |
commit | 54468d5ab191f12496df34cb2239e823e77e1c1c (patch) | |
tree | b06cb41c94d0434729e9a6c1c35320b9312418f7 | |
parent | f97b1c806d1601f59fdeb322a57a7b92cbf2a350 (diff) | |
download | pango-54468d5ab191f12496df34cb2239e823e77e1c1c.tar.gz |
Add a way to pass flags to shaping
We want to influence shaping in some ways,
e.g. make spaces visible, so add a variant
of pango_shape() that takes flags.
-rw-r--r-- | docs/pango-sections.txt | 2 | ||||
-rw-r--r-- | pango/pango-glyph.h | 13 | ||||
-rw-r--r-- | pango/shape.c | 34 |
3 files changed, 47 insertions, 2 deletions
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt index e7130fd9..e0b1ef52 100644 --- a/docs/pango-sections.txt +++ b/docs/pango-sections.txt @@ -57,6 +57,8 @@ PangoLogAttr <SUBSECTION> pango_shape pango_shape_full +PangoShapeFlags +pango_shape_with_options <SUBSECTION Private> pango_context_get_type diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h index f24812cf..b3112e06 100644 --- a/pango/pango-glyph.h +++ b/pango/pango-glyph.h @@ -208,6 +208,19 @@ void pango_shape_full (const gchar *item_text, const PangoAnalysis *analysis, PangoGlyphString *glyphs); +typedef enum { + PANGO_SHAPE_NONE, +} PangoShapeFlags; + +PANGO_AVAILABLE_IN_1_44 +void pango_shape_with_options (const gchar *item_text, + gint item_length, + const gchar *paragraph_text, + gint paragraph_length, + const PangoAnalysis *analysis, + PangoShapeFlags flags, + PangoGlyphString *glyphs); + PANGO_AVAILABLE_IN_ALL GList *pango_reorder_items (GList *logical_items); diff --git a/pango/shape.c b/pango/shape.c index cfda7588..d387181a 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -61,7 +61,8 @@ pango_shape (const gchar *text, const PangoAnalysis *analysis, PangoGlyphString *glyphs) { - pango_shape_full (text, length, text, length, analysis, glyphs); + pango_shape_with_options (text, length, text, length, + analysis, PANGO_SHAPE_NONE, glyphs); } static void @@ -141,7 +142,36 @@ pango_shape_full (const gchar *item_text, const gchar *paragraph_text, gint paragraph_length, const PangoAnalysis *analysis, - PangoGlyphString *glyphs) + PangoGlyphString *glyphs) +{ + pango_shape_with_options (item_text, item_length, + paragraph_text, paragraph_length, + analysis, PANGO_SHAPE_NONE, glyphs); +} + +/** + * pango_shape_with_options: + * @item_text: valid UTF-8 text to shape. + * @item_length: the length (in bytes) of @item_text. -1 means nul-terminated text. + * @paragraph_text: (allow-none): text of the paragraph (see details). May be %NULL. + * @paragraph_length: the length (in bytes) of @paragraph_text. -1 means nul-terminated text. + * @analysis: #PangoAnalysis structure from pango_itemize(). + * @flags: flags influencing the overal shaping operation + * @glyphs: glyph string in which to store results. + * + * A variant of pango_shape_full() that takes an extra + * @flags argument to influence the details of the shaping. + * + * Since: 1.44 + */ +void +pango_shape_with_options (const gchar *item_text, + gint item_length, + const gchar *paragraph_text, + gint paragraph_length, + const PangoAnalysis *analysis, + PangoShapeFlags flags, + PangoGlyphString *glyphs) { int i; int last_cluster; |