[pango/pango2: 59/201] Stop using pango_itemize




commit 2fbf7813552a832ba197dc66b2c95f0e86e0931f
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 17 14:25:06 2022 -0600

    Stop using pango_itemize
    
    Use pango_itemize_with_base_dir everywhere.

 pango/ellipsize.c    | 4 +++-
 pango/pango-layout.c | 4 +++-
 tests/test-font.c    | 4 +++-
 tests/test-itemize.c | 4 +++-
 tests/test-shape.c   | 4 +++-
 tests/testmisc.c     | 4 +++-
 6 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index 9601945c..6d79e0a7 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -284,8 +284,10 @@ itemize_text (EllipsizeState *state,
 {
   GList *items;
   PangoItem *item;
+  PangoDirection dir;
 
-  items = pango_itemize (state->layout->context, text, 0, strlen (text), attrs, NULL);
+  dir = pango_context_get_base_dir (state->layout->context);
+  items = pango_itemize_with_base_dir (state->layout->context, dir, text, 0, strlen (text), attrs, NULL);
   g_assert (g_list_length (items) == 1);
 
   item = items->data;
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 695e4dc2..f846b6ef 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3349,7 +3349,9 @@ ensure_tab_width (PangoLayout *layout)
           pango_attr_list_insert_before (&tmp_attrs, attr);
         }
 
-      items = pango_itemize (layout->context, " ", 0, 1, &tmp_attrs, NULL);
+      items = pango_itemize_with_base_dir (layout->context,
+                                           pango_context_get_base_dir (layout->context),
+                                           " ", 0, 1, &tmp_attrs, NULL);
 
       if (layout_attrs != layout->attrs)
         {
diff --git a/tests/test-font.c b/tests/test-font.c
index 373467b4..4dcbd819 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -194,13 +194,15 @@ test_extents (void)
   PangoRectangle ink, log;
   PangoContext *context;
   PangoFontDescription *desc;
+  PangoDirection dir;
 
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
   desc = pango_font_description_from_string("Cantarell 11");
   pango_context_set_font_description (context, desc);
   pango_font_description_free (desc);
 
-  items = pango_itemize (context, str, 0, strlen (str), NULL, NULL);
+  dir = pango_context_get_base_dir (context);
+  items = pango_itemize_with_base_dir (context, dir, str, 0, strlen (str), NULL, NULL);
   glyphs = pango_glyph_string_new ();
   item = items->data;
   pango_shape (str, strlen (str), NULL, 0, &item->analysis, glyphs, PANGO_SHAPE_NONE);
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 29b43dde..d58bdbc7 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -128,6 +128,7 @@ test_file (const gchar *filename, GString *string)
   PangoAttrList *itemize_attrs;
   GList *items, *l;
   const char *sep = "";
+  PangoDirection dir;
 
   g_file_get_contents (filename, &contents, &length, &error);
   g_assert_no_error (error);
@@ -154,7 +155,8 @@ test_file (const gchar *filename, GString *string)
     length--;
 
   itemize_attrs = pango_attr_list_filter (attrs, affects_itemization, NULL);
-  items = pango_itemize (context, text, 0, length, itemize_attrs, NULL);
+  dir = pango_context_get_base_dir (context);
+  items = pango_itemize_with_base_dir (context, dir, text, 0, length, itemize_attrs, NULL);
 
   apply_attributes_to_items (items, attrs);
   pango_attr_list_unref (itemize_attrs);
diff --git a/tests/test-shape.c b/tests/test-shape.c
index 9380976f..e5e5b07b 100644
--- a/tests/test-shape.c
+++ b/tests/test-shape.c
@@ -145,6 +145,7 @@ test_file (const gchar *filename, GString *string)
   GString *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
   char *p1;
   const char *sep = "";
+  PangoDirection dir;
 
   if (!g_file_get_contents (filename, &contents, &length, &error))
     {
@@ -183,7 +184,8 @@ test_file (const gchar *filename, GString *string)
   itemize_attrs = pango_attr_list_filter (attrs, affects_itemization, NULL);
   shape_attrs = pango_attr_list_filter (attrs, affects_break_or_shape, NULL);
 
-  items = pango_itemize (context, text, 0, length, itemize_attrs, NULL);
+  dir = pango_context_get_base_dir (context);
+  items = pango_itemize_with_base_dir (context, dir, text, 0, length, itemize_attrs, NULL);
   apply_attributes_to_items (items, shape_attrs);
 
   pango_attr_list_unref (itemize_attrs);
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 63d21119..5d503f0d 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -390,11 +390,13 @@ test_fallback_shape (void)
   PangoContext *context;
   const char *text;
   GList *items, *l;
+  PangoDirection dir;
 
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+  dir = pango_context_get_base_dir (context);
 
   text = "Some text to sha​pe ﺄﻧﺍ ﻕﺍﺩﺭ ﻊﻟﻯ ﺄﻜﻟ ﺎﻟﺰﺟﺎﺟ ﻭ ﻩﺫﺍ ﻻ ﻱﺆﻠﻤﻨﻳ";
-  items = pango_itemize (context, text, 0, strlen (text), NULL, NULL);
+  items = pango_itemize_with_base_dir (context, dir, text, 0, strlen (text), NULL, NULL);
   for (l = items; l; l = l->next)
     {
       PangoItem *item = l->data;


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