[pango/pango2: 83/195] Stop using pango_itemize
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 83/195] Stop using pango_itemize
- Date: Mon, 6 Jun 2022 04:14:41 +0000 (UTC)
commit 857cb20daed2813b4de90926497480f1fb0b1c87
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 66422397..b4ab7e3a 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3351,7 +3351,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 shape ﺄﻧﺍ ﻕﺍﺩﺭ ﻊﻟﻯ ﺄﻜﻟ ﺎﻟﺰﺟﺎﺟ ﻭ ﻩﺫﺍ ﻻ ﻱﺆﻠﻤﻨﻳ";
- 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]