[pango/pango2: 66/84] Seal PangoItem




commit 302953ea5f07b127af173e84ba63181437d01423
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jun 9 06:59:05 2022 -0400

    Seal PangoItem
    
    Add getters to access the current fields of
    PangoItem and PangoAnalysis, and hide the
    structs.
    
    pango code and tests still access the structs
    directly, but examples and utilities have been
    ported to the getters.

 examples/userfont.c        |  2 +-
 pango/break-indic.c        |  1 +
 pango/break-latin.c        |  1 +
 pango/break.c              |  1 +
 pango/ellipsize.c          |  1 +
 pango/glyphstring.c        | 45 ++++++++++++------------
 pango/pango-glyph-item.c   |  1 +
 pango/pango-glyph.h        |  6 ++--
 pango/pango-item-private.h | 51 +++++++++++++++++++++++++++
 pango/pango-item.c         | 72 ++++++++++++++++++++++++++++++++++++++
 pango/pango-item.h         | 87 ++++++++++++++++------------------------------
 pango/pango-userface.c     |  1 +
 pango/pangocairo-render.c  |  1 +
 pango/reorder-items.c      |  2 +-
 pango/serializer.c         |  1 +
 tests/test-font.c          |  1 +
 tests/testiter.c           | 21 ++++++-----
 tests/testmisc.c           |  1 +
 utils/viewer-pangocairo.c  | 28 ++++++++-------
 19 files changed, 220 insertions(+), 104 deletions(-)
---
diff --git a/examples/userfont.c b/examples/userfont.c
index eb5c504b0..35df63ca1 100644
--- a/examples/userfont.c
+++ b/examples/userfont.c
@@ -193,7 +193,7 @@ shape_cb (PangoUserFace       *face,
         glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
 
       glyph_info_cb (face, size, glyph, &ext, &dummy, &dummy, &is_color, user_data);
-      pango_font_get_glyph_extents (analysis->font, glyph, NULL, &logical_rect);
+      pango_font_get_glyph_extents (pango_analysis_get_font (analysis), glyph, NULL, &logical_rect);
 
       glyphs->glyphs[j].glyph = glyph;
 
diff --git a/pango/break-indic.c b/pango/break-indic.c
index 045cd760d..9f890cc0c 100644
--- a/pango/break-indic.c
+++ b/pango/break-indic.c
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include "pango-break.h"
+#include "pango-item-private.h"
 
 #define DEV_RRA 0x0931 /* 0930 + 093c */
 #define DEV_QA 0x0958 /* 0915 + 093c */
diff --git a/pango/break-latin.c b/pango/break-latin.c
index 69ad51109..384c7e20b 100644
--- a/pango/break-latin.c
+++ b/pango/break-latin.c
@@ -21,6 +21,7 @@
 #include "config.h"
 
 #include "pango-break.h"
+#include "pango-item-private.h"
 #include "pango-impl-utils.h"
 
 static void
diff --git a/pango/break.c b/pango/break.c
index 05e1aea57..0fba06523 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -28,6 +28,7 @@
 #include "pango-attr-list-private.h"
 #include "pango-attr-iterator-private.h"
 #include "pango-break-table.h"
+#include "pango-item-private.h"
 #include "pango-impl-utils.h"
 #include <string.h>
 
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index 9f68c6e93..cbd5fdc3d 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -22,6 +22,7 @@
 #include "config.h"
 #include <string.h>
 
+#include "pango-item-private.h"
 #include "pango-glyph-item.h"
 #include "pango-font-private.h"
 #include "pango-attributes-private.h"
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index baec223d3..c42133ca7 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -23,6 +23,7 @@
 #include <glib.h>
 #include "pango-glyph.h"
 #include "pango-font.h"
+#include "pango-item-private.h"
 #include "pango-impl-utils.h"
 
 #include <hb-ot.h>
@@ -378,13 +379,13 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
  * </picture>
  */
 void
-pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
-                               const char       *text,
-                               int               length,
-                               PangoAnalysis    *analysis,
-                               int               index,
-                               gboolean          trailing,
-                               int              *x_pos)
+pango_glyph_string_index_to_x (PangoGlyphString    *glyphs,
+                               const char          *text,
+                               int                  length,
+                               const PangoAnalysis *analysis,
+                               int                  index,
+                               gboolean             trailing,
+                               int                 *x_pos)
 {
   pango_glyph_string_index_to_x_full (glyphs,
                                       text, length,
@@ -414,14 +415,14 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
  * clusters.
  */
 void
-pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs,
-                                    const char       *text,
-                                    int               length,
-                                    PangoAnalysis    *analysis,
-                                    PangoLogAttr     *attrs,
-                                    int               index,
-                                    gboolean          trailing,
-                                    int              *x_pos)
+pango_glyph_string_index_to_x_full (PangoGlyphString    *glyphs,
+                                    const char          *text,
+                                    int                  length,
+                                    const PangoAnalysis *analysis,
+                                    PangoLogAttr        *attrs,
+                                    int                  index,
+                                    gboolean             trailing,
+                                    int                 *x_pos)
 {
   int i;
   int start_xpos = 0;
@@ -638,13 +639,13 @@ fallback:
  * attributes for the text to compute the valid cursor position.
  */
 void
-pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
-                               const char       *text,
-                               int               length,
-                               PangoAnalysis    *analysis,
-                               int               x_pos,
-                               int              *index,
-                               gboolean         *trailing)
+pango_glyph_string_x_to_index (PangoGlyphString    *glyphs,
+                               const char          *text,
+                               int                  length,
+                               const PangoAnalysis *analysis,
+                               int                  x_pos,
+                               int                 *index,
+                               gboolean            *trailing)
 {
   int i;
   int start_xpos = 0;
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index 9542a23e9..293e20ad0 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include "pango-glyph-item.h"
+#include "pango-item-private.h"
 #include "pango-impl-utils.h"
 #include "pango-attr-list-private.h"
 #include "pango-attr-iterator-private.h"
diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h
index e61b169f9..5511b37a0 100644
--- a/pango/pango-glyph.h
+++ b/pango/pango-glyph.h
@@ -187,7 +187,7 @@ PANGO_AVAILABLE_IN_ALL
 void                    pango_glyph_string_index_to_x           (PangoGlyphString    *glyphs,
                                                                  const char          *text,
                                                                  int                  length,
-                                                                 PangoAnalysis       *analysis,
+                                                                 const PangoAnalysis *analysis,
                                                                  int                  index_,
                                                                  gboolean             trailing,
                                                                  int                 *x_pos);
@@ -195,7 +195,7 @@ PANGO_AVAILABLE_IN_ALL
 void                    pango_glyph_string_x_to_index           (PangoGlyphString    *glyphs,
                                                                  const char          *text,
                                                                  int                  length,
-                                                                 PangoAnalysis       *analysis,
+                                                                 const PangoAnalysis *analysis,
                                                                  int                  x_pos,
                                                                  int                 *index_,
                                                                  int                 *trailing);
@@ -204,7 +204,7 @@ PANGO_AVAILABLE_IN_ALL
 void                    pango_glyph_string_index_to_x_full      (PangoGlyphString    *glyphs,
                                                                  const char          *text,
                                                                  int                  length,
-                                                                 PangoAnalysis       *analysis,
+                                                                 const PangoAnalysis *analysis,
                                                                  PangoLogAttr        *attrs,
                                                                  int                  index_,
                                                                  gboolean             trailing,
diff --git a/pango/pango-item-private.h b/pango/pango-item-private.h
index 6eb033e59..2f4f8c972 100644
--- a/pango/pango-item-private.h
+++ b/pango/pango-item-private.h
@@ -22,6 +22,57 @@
 #include <pango/pango-item.h>
 #include <pango/pango-break.h>
 
+/*< private >
+ * PangoAnalysis:
+ * @size_font: font to use for determining line height
+ * @font: the font for this segment
+ * @level: the bidirectional level for this segment.
+ * @gravity: the glyph orientation for this segment (A `PangoGravity`).
+ * @flags: boolean flags for this segment
+ * @script: the detected script for this segment (A `PangoScript`)
+ * @language: the detected language for this segment.
+ * @extra_attrs: extra attributes for this segment.
+ *
+ * The `PangoAnalysis` structure stores information about
+ * the properties of a segment of text.
+ */
+struct _PangoAnalysis
+{
+  PangoFont *size_font;
+  PangoFont *font;
+
+  guint8 level;
+  guint8 gravity;
+  guint8 flags;
+
+  guint8 script;
+  PangoLanguage *language;
+
+  GSList *extra_attrs;
+};
+
+/*< private>
+ * PangoItem:
+ * @offset: byte offset of the start of this item in text.
+ * @length: length of this item in bytes.
+ * @num_chars: number of Unicode characters in the item.
+ * @char_offset: character offset of the start of this item in text. Since 1.50
+ * @analysis: analysis results for the item.
+ *
+ * The `PangoItem` structure stores information about a segment of text.
+ *
+ * You typically obtain `PangoItems` by itemizing a piece of text
+ * with [func@itemize].
+ */
+struct _PangoItem
+{
+  int offset;
+  int length;
+  int num_chars;
+  int char_offset;
+  PangoAnalysis analysis;
+};
+
 
 void               pango_analysis_collect_features    (const PangoAnalysis        *analysis,
                                                        hb_feature_t               *features,
diff --git a/pango/pango-item.c b/pango/pango-item.c
index f1676a795..a7cdbae1c 100644
--- a/pango/pango-item.c
+++ b/pango/pango-item.c
@@ -463,3 +463,75 @@ pango_item_get_properties (PangoItem      *item,
       tmp_list = tmp_list->next;
     }
 }
+
+PangoFont *
+pango_analysis_get_font (const PangoAnalysis *analysis)
+{
+  return analysis->font;
+}
+
+int
+pango_analysis_get_bidi_level (const PangoAnalysis *analysis)
+{
+  return analysis->level;
+}
+
+PangoGravity
+pango_analysis_get_gravity (const PangoAnalysis *analysis)
+{
+  return (PangoGravity) analysis->gravity;
+}
+
+guint
+pango_analysis_get_flags (const PangoAnalysis *analysis)
+{
+  return analysis->flags;
+}
+
+GUnicodeScript
+pango_analysis_get_script (const PangoAnalysis *analysis)
+{
+  return (GUnicodeScript) analysis->script;
+}
+
+PangoLanguage *
+pango_analysis_get_language (const PangoAnalysis *analysis)
+{
+  return analysis->language;
+}
+
+GSList *
+pango_analysis_get_extra_attributes (const PangoAnalysis *analysis)
+{
+  return analysis->extra_attrs;
+}
+
+const PangoAnalysis *
+pango_item_get_analysis (PangoItem *item)
+{
+  return &item->analysis;
+}
+
+int
+pango_item_get_byte_offset (PangoItem *item)
+{
+  return item->offset;
+}
+
+int
+pango_item_get_byte_length (PangoItem *item)
+{
+  return item->length;
+}
+
+int
+pango_item_get_char_offset (PangoItem *item)
+{
+  return item->char_offset;
+}
+
+int
+pango_item_get_char_length (PangoItem *item)
+{
+  return item->num_chars;
+}
diff --git a/pango/pango-item.h b/pango/pango-item.h
index de4b857fb..7e58aab6a 100644
--- a/pango/pango-item.h
+++ b/pango/pango-item.h
@@ -51,57 +51,6 @@ typedef struct _PangoItem PangoItem;
  */
 #define PANGO_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2)
 
-/**
- * PangoAnalysis:
- * @size_font: font to use for determining line height
- * @font: the font for this segment
- * @level: the bidirectional level for this segment.
- * @gravity: the glyph orientation for this segment (A `PangoGravity`).
- * @flags: boolean flags for this segment
- * @script: the detected script for this segment (A `PangoScript`)
- * @language: the detected language for this segment.
- * @extra_attrs: extra attributes for this segment.
- *
- * The `PangoAnalysis` structure stores information about
- * the properties of a segment of text.
- */
-struct _PangoAnalysis
-{
-  PangoFont *size_font;
-  PangoFont *font;
-
-  guint8 level;
-  guint8 gravity;
-  guint8 flags;
-
-  guint8 script;
-  PangoLanguage *language;
-
-  GSList *extra_attrs;
-};
-
-/**
- * PangoItem:
- * @offset: byte offset of the start of this item in text.
- * @length: length of this item in bytes.
- * @num_chars: number of Unicode characters in the item.
- * @char_offset: character offset of the start of this item in text. Since 1.50
- * @analysis: analysis results for the item.
- *
- * The `PangoItem` structure stores information about a segment of text.
- *
- * You typically obtain `PangoItems` by itemizing a piece of text
- * with [func@itemize].
- */
-struct _PangoItem
-{
-  int offset;
-  int length;
-  int num_chars;
-  int char_offset;
-  PangoAnalysis analysis;
-};
-
 #define PANGO_TYPE_ITEM (pango_item_get_type ())
 
 PANGO_AVAILABLE_IN_ALL
@@ -129,12 +78,36 @@ GList *                 pango_reorder_items          (GList             *items);
 /* Itemization */
 
 PANGO_AVAILABLE_IN_ALL
-GList *                 pango_itemize (PangoContext      *context,
-                                       PangoDirection     base_dir,
-                                       const char        *text,
-                                       int                start_index,
-                                       int                length,
-                                       PangoAttrList     *attrs);
+GList *                 pango_itemize                (PangoContext      *context,
+                                                      PangoDirection     base_dir,
+                                                      const char        *text,
+                                                      int                start_index,
+                                                      int                length,
+                                                      PangoAttrList     *attrs);
 
+PANGO_AVAILABLE_IN_ALL
+PangoFont *             pango_analysis_get_font                 (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+int                     pango_analysis_get_bidi_level           (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+PangoGravity            pango_analysis_get_gravity              (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+guint                   pango_analysis_get_flags                (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+GUnicodeScript          pango_analysis_get_script               (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+PangoLanguage *         pango_analysis_get_language             (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+GSList *                pango_analysis_get_extra_attributes     (const PangoAnalysis *analysis);
+PANGO_AVAILABLE_IN_ALL
+const PangoAnalysis *   pango_item_get_analysis                 (PangoItem *item);
+PANGO_AVAILABLE_IN_ALL
+int                     pango_item_get_byte_offset              (PangoItem *item);
+PANGO_AVAILABLE_IN_ALL
+int                     pango_item_get_byte_length              (PangoItem *item);
+PANGO_AVAILABLE_IN_ALL
+int                     pango_item_get_char_offset              (PangoItem *item);
+PANGO_AVAILABLE_IN_ALL
+int                     pango_item_get_char_length              (PangoItem *item);
 
 G_END_DECLS
diff --git a/pango/pango-userface.c b/pango/pango-userface.c
index 98fc0b8a7..a9f16c090 100644
--- a/pango/pango-userface.c
+++ b/pango/pango-userface.c
@@ -24,6 +24,7 @@
 #include "pango-userface-private.h"
 #include "pango-userfont-private.h"
 #include "pango-utils.h"
+#include "pango-item-private.h"
 #include "pango-impl-utils.h"
 
 #include <string.h>
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index afb2a9346..590ca4aa9 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -23,6 +23,7 @@
 
 #include <math.h>
 
+#include "pango-item-private.h"
 #include "pango-font-private.h"
 #include "pangocairo-private.h"
 #include "pango-glyph-item.h"
diff --git a/pango/reorder-items.c b/pango/reorder-items.c
index c30d003bd..27ce905cf 100644
--- a/pango/reorder-items.c
+++ b/pango/reorder-items.c
@@ -20,7 +20,7 @@
  */
 
 #include "config.h"
-#include "pango-item.h"
+#include "pango-item-private.h"
 
 /*
  * NB: The contents of the file implement the exact same algorithm
diff --git a/pango/serializer.c b/pango/serializer.c
index 2ad0d4229..b821904d4 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -29,6 +29,7 @@
 #include <pango/pango-hbface.h>
 #include <pango/pango-attributes.h>
 #include <pango/pango-attr-private.h>
+#include <pango/pango-item-private.h>
 
 #include <hb-ot.h>
 #include "pango/json/gtkjsonparserprivate.h"
diff --git a/tests/test-font.c b/tests/test-font.c
index edfde0021..3b45ba299 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -25,6 +25,7 @@
 
 #include <gio/gio.h>
 #include <pango/pango.h>
+#include <pango/pango-item-private.h>
 
 static PangoContext *context;
 
diff --git a/tests/testiter.c b/tests/testiter.c
index 3dea2e728..9d4bc6458 100644
--- a/tests/testiter.c
+++ b/tests/testiter.c
@@ -118,30 +118,35 @@ iter_char_test (PangoLayout *layout)
           PangoFontDescription *desc;
           char *str;
           PangoItem *item;
+          const PangoAnalysis *analysis;
           PangoGlyphString *glyphs;
+          int length;
 
           item = pango_run_get_item (run);
+          analysis = pango_item_get_analysis (item);
           glyphs = pango_run_get_glyphs (run);
 
           /* Get needed data for the GlyphString */
           pango_line_iter_get_run_extents (iter, NULL, &run_extents);
-          offset = item->offset;
-          rtl = item->analysis.level%2;
-          desc = pango_font_describe (item->analysis.font);
+          offset = pango_item_get_byte_offset (item);
+          length = pango_item_get_byte_length (item);
+
+          rtl = pango_analysis_get_bidi_level (analysis) % 2;
+          desc = pango_font_describe (pango_analysis_get_font (analysis));
           str = pango_font_description_to_string (desc);
           verbose ("  (current run: font=%s,offset=%d,x=%d,len=%d,rtl=%d)\n",
-                   str, offset, run_extents.x, item->length, rtl);
+                   str, offset, run_extents.x, length, rtl);
           g_free (str);
           pango_font_description_free (desc);
 
           /* Calculate expected x result using index_to_x */
           pango_glyph_string_index_to_x (glyphs,
-                                         (char *)(text + offset), item->length,
-                                         &item->analysis,
+                                         (char *)(text + offset), length,
+                                         pango_item_get_analysis (item),
                                          index - offset, FALSE, &leading_x);
           pango_glyph_string_index_to_x (glyphs,
-                                         (char *)(text + offset), item->length,
-                                         &item->analysis,
+                                         (char *)(text + offset), length,
+                                         pango_item_get_analysis (item),
                                          index - offset, TRUE, &trailing_x);
 
           x0 = run_extents.x + MIN (leading_x, trailing_x);
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 4e47593c9..dc1cb1cfd 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -22,6 +22,7 @@
 #include "config.h"
 #include <glib.h>
 #include <pango/pangocairo.h>
+#include <pango/pango-item-private.h>
 
 /* Test that itemizing a string with 0 characters works
  */
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index a9daf388d..8c11df214 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -326,6 +326,7 @@ render_callback (PangoLayout *layout,
             {
               PangoRun *run;
               PangoItem *item;
+              const PangoAnalysis *analysis;
               PangoRectangle rect;
               hb_font_t *hb_font;
               hb_ot_layout_baseline_tag_t baselines[] = {
@@ -350,12 +351,13 @@ render_callback (PangoLayout *layout,
                 }
 
               item = pango_run_get_item (run);
+              analysis = pango_item_get_analysis (item);
 
               if (baseline_tag == 0)
                 {
-                  hb_script_t script = (hb_script_t) g_unicode_script_to_iso15924 (item->analysis.script);
+                  hb_script_t script = (hb_script_t) g_unicode_script_to_iso15924 (pango_analysis_get_script 
(analysis));
 
-                  if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+                  if (pango_analysis_get_flags (analysis) & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
                     baseline_tag = HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL;
                   else
                     baseline_tag = hb_ot_layout_get_horizontal_baseline_tag_for_script (script);
@@ -364,12 +366,12 @@ render_callback (PangoLayout *layout,
               y = pango_line_iter_get_run_baseline (iter);
               pango_line_iter_get_run_extents (iter, NULL, &rect);
 
-              hb_font = pango_font_get_hb_font (item->analysis.font);
-              if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+              hb_font = pango_font_get_hb_font (pango_analysis_get_font (analysis));
+              if (pango_analysis_get_flags (analysis) & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
                 dir = HB_DIRECTION_TTB;
               else
                 dir = HB_DIRECTION_LTR;
-              script = (hb_script_t) g_unicode_script_to_iso15924 (item->analysis.script);
+              script = (hb_script_t) g_unicode_script_to_iso15924 (pango_analysis_get_script (analysis));
               lang = HB_TAG_NONE;
 
               for (int i = 0; i < G_N_ELEMENTS (baselines); i++)
@@ -568,6 +570,7 @@ render_callback (PangoLayout *layout,
             {
               PangoRun *run;
               PangoItem *item;
+              const PangoAnalysis *analysis;
               PangoGlyphString *glyphs;
               PangoRectangle rect;
               int x_pos, y_pos;
@@ -577,6 +580,7 @@ render_callback (PangoLayout *layout,
                 continue;
 
               item = pango_run_get_item (run);
+              analysis = pango_item_get_analysis (item);
               glyphs = pango_run_get_glyphs (run);
 
               pango_line_iter_get_run_extents (iter, NULL, &rect);
@@ -588,7 +592,7 @@ render_callback (PangoLayout *layout,
                 {
                   PangoRectangle extents;
 
-                  pango_font_get_glyph_extents (item->analysis.font,
+                  pango_font_get_glyph_extents (pango_analysis_get_font (analysis),
                                                 glyphs->glyphs[i].glyph,
                                                 &extents, NULL);
 
@@ -652,7 +656,7 @@ render_callback (PangoLayout *layout,
               glyphs = pango_run_get_glyphs (run);
 
               text = pango_layout_get_text (layout);
-              start = text + item->offset;
+              start = text + pango_item_get_char_offset (item);
 
               offset = g_utf8_strlen (text, start - text);
 
@@ -660,14 +664,14 @@ render_callback (PangoLayout *layout,
 
               trailing = FALSE;
               p = start;
-              for (int i = 0; i <= item->num_chars; i++)
+              for (int i = 0; i <= pango_item_get_char_length (item); i++)
                 {
                   if (attrs[offset + i].is_cursor_position)
                     {
                       pango_glyph_string_index_to_x_full (glyphs,
-                                                          text + item->offset,
-                                                          item->length,
-                                                          &item->analysis,
+                                                          text + pango_item_get_byte_offset (item),
+                                                          pango_item_get_byte_length (item),
+                                                          pango_item_get_analysis (item),
                                                           (PangoLogAttr *)attrs + offset,
                                                           p - start,
                                                           trailing,
@@ -686,7 +690,7 @@ render_callback (PangoLayout *layout,
                       g_free (s);
                    }
 
-                  if (i < item->num_chars)
+                  if (i < pango_item_get_char_length (item))
                     {
                       num++;
                       p = g_utf8_next_char (p);


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