[pango/visible-things: 8/35] Add a way to pass flags to shaping



commit 9def4524c09924898096646edc84fdf4f036d3cc
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 7 12:08:41 2019 -0400

    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.

 docs/pango-sections.txt |  2 ++
 pango/pango-glyph.h     | 13 +++++++++++++
 pango/shape.c           | 34 ++++++++++++++++++++++++++++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 61823711..66e12ca2 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 6f535262..fb2e980f 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -59,7 +59,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);
 }
 
 /**
@@ -90,7 +91,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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]