diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-24 21:39:24 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-25 08:12:21 -0500 |
commit | 4be56840ddead48d8b4f6d63775eb3fafc764f9d (patch) | |
tree | 43d16b5a646ef7f8819be2af80514397c0273c4c /tests | |
parent | 05be686a512299fc03e987399819ff13b7935b81 (diff) | |
download | pango-4be56840ddead48d8b4f6d63775eb3fafc764f9d.tar.gz |
test-layout: Use an fc fontmap
Our new, more precise font checks rely on
data from fontconfig to identify fonts
uniquely. So make sure that we use a custom
fc fontmap, if we have one.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-layout.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c index 93a6118f..5a260f99 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -29,6 +29,7 @@ #include "config.h" #include <pango/pangocairo.h> +#include <pango/pangocairo-fc.h> #include <pango/pangofc-fontmap.h> #include "test-common.h" @@ -46,6 +47,12 @@ test_layout (gconstpointer d) PangoContext *context; PangoLayout *layout; + if (!PANGO_IS_FC_FONT_MAP (pango_cairo_font_map_get_default ())) + { + g_test_skip ("Not an fc fontmap. Skipping..."); + return; + } + char *old_locale = g_strdup (setlocale (LC_ALL, NULL)); setlocale (LC_ALL, "en_US.UTF-8"); if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL) @@ -104,6 +111,8 @@ install_fonts (const char *dir) PangoFontMap *map; char *conf; + map = g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL); + config = FcConfigCreate (); conf = g_strdup_printf ("<?xml version=\"1.0\"?>\n" @@ -118,9 +127,12 @@ install_fonts (const char *dir) g_free (conf); FcConfigAppFontAddDir (config, (const FcChar8 *) dir); - map = pango_cairo_font_map_get_default (); pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (map), config); FcConfigDestroy (config); + + pango_cairo_font_map_set_default (PANGO_CAIRO_FONT_MAP (map)); + + g_object_unref (map); } int |