[pango/pango2: 113/135] tests: Adapt
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 113/135] tests: Adapt
- Date: Fri, 18 Feb 2022 20:11:03 +0000 (UTC)
commit 4de8947e688671705e116c77b6cbc8cd89fdeac5
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 28 00:14:00 2022 -0500
tests: Adapt
tests/testhbfont.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/tests/testhbfont.c b/tests/testhbfont.c
index 65a54ca9..6b6860a9 100644
--- a/tests/testhbfont.c
+++ b/tests/testhbfont.c
@@ -394,7 +394,7 @@ test_hbfont_load (void)
pango_font_description_free (desc);
g_free (path);
- pango_hb_font_map_add_face (map, (PangoFontFace *)face_fat);
+ pango_hb_font_map_add_face (map, PANGO_FONT_FACE (face_fat));
path = g_test_build_filename (G_TEST_DIST, "fonts", "DejaVuSans.ttf", NULL);
desc = pango_font_description_new ();
@@ -402,7 +402,7 @@ test_hbfont_load (void)
face_wild = pango_hb_face_new_from_file (path, 0, -1, "Wild", desc);
pango_font_description_free (desc);
- pango_hb_font_map_add_face (map, (PangoFontFace *)face_wild);
+ pango_hb_font_map_add_face (map, PANGO_FONT_FACE (face_wild));
desc = pango_font_face_describe (PANGO_FONT_FACE (face_wild));
pango_font_description_set_size (desc, 12 * PANGO_SCALE);
@@ -460,7 +460,7 @@ test_hbfont_load_variation (void)
pango_font_description_free (desc);
g_free (path);
- pango_hb_font_map_add_face (map, (PangoFontFace *)face_fat);
+ pango_hb_font_map_add_face (map, PANGO_FONT_FACE (face_fat));
desc = pango_font_description_new ();
pango_font_description_set_family (desc, "Cat");
@@ -469,7 +469,7 @@ test_hbfont_load_variation (void)
face_wild = pango_hb_face_new_instance (face_fat, &v, 1, "Wild", desc);
pango_font_description_free (desc);
- pango_hb_font_map_add_face (map, (PangoFontFace *)face_wild);
+ pango_hb_font_map_add_face (map, PANGO_FONT_FACE (face_wild));
desc = pango_font_face_describe (PANGO_FONT_FACE (face_wild));
@@ -630,12 +630,13 @@ compare_family_name (gconstpointer a,
static gboolean
is_generic_family (PangoFontFamily *fam)
{
- const char *name = pango_font_family_get_name (fam);
-
- if (strcmp (G_OBJECT_TYPE_NAME (fam), "PangoGenericFamily") == 0)
- return TRUE;
+ return g_str_equal (G_OBJECT_TYPE_NAME (fam), "PangoGenericFamily");
+}
- return g_strv_contains ((const char *[]){ "Sans", "Serif", "Monospace", "System-ui", NULL}, name);
+static gboolean
+is_generic_family_name (const char *family)
+{
+ return g_strv_contains ((const char *[]){ "Sans", "Serif", "Monospace", "System-ui", NULL}, family);
}
static const char * const *
@@ -646,9 +647,10 @@ collect_nongeneric_families (PangoFontMap *map)
for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (map)); i++)
{
PangoFontFamily *fam = g_list_model_get_item (G_LIST_MODEL (map), i);
+ const char *name = pango_font_family_get_name (fam);
- if (!is_generic_family (fam))
- g_ptr_array_add (array, (gpointer)pango_font_family_get_name (fam));
+ if (!(is_generic_family (fam) || is_generic_family_name (name)))
+ g_ptr_array_add (array, (gpointer)name);
g_object_unref (fam);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]