summaryrefslogtreecommitdiff
path: root/tests/test-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-03-13 09:12:28 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-06-22 11:33:21 -0400
commitc0e67b7575ce9e43d11ccd6e09a4fb516da64342 (patch)
tree23f96126959363666fa1a28951b6fdbac90c7dbc /tests/test-layout.c
parent6daa839540629af4fae2152d54339ae2cbe69f5b (diff)
downloadpango-c0e67b7575ce9e43d11ccd6e09a4fb516da64342.tar.gz
test-layout: port to PangoFcHbFontMap
Diffstat (limited to 'tests/test-layout.c')
-rw-r--r--tests/test-layout.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c
index f440952b..b42f8f93 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -30,8 +30,10 @@
#include "config.h"
#include <pango/pangocairo.h>
#include <pango/pangocairo-fc.h>
+#include <pango/pangofc-hbfontmap.h>
#include "test-common.h"
+static PangoFontMap *map = NULL;
static void
test_layout (gconstpointer d)
@@ -46,12 +48,6 @@ test_layout (gconstpointer d)
PangoContext *context;
PangoLayout *layout;
- if (!PANGO_FC_IS_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)
@@ -67,7 +63,7 @@ test_layout (gconstpointer d)
g_assert_no_error (error);
orig = g_bytes_new_take (contents, length);
- context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ context = pango_font_map_create_context (map);
layout = pango_layout_deserialize (context, orig, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
g_assert_no_error (error);
@@ -108,13 +104,10 @@ static void
install_fonts (const char *dir)
{
FcConfig *config;
- PangoFontMap *map;
char *path;
gsize len;
char *conf;
- map = g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL);
-
config = FcConfigCreate ();
path = g_build_filename (dir, "fonts.conf", NULL);
@@ -127,12 +120,11 @@ install_fonts (const char *dir)
g_free (path);
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
- 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));
+ map = PANGO_FONT_MAP (pango_fc_hb_font_map_new ());
+ pango_fc_hb_font_map_set_config (PANGO_FC_HB_FONT_MAP (map), config);
- g_object_unref (map);
+ FcConfigDestroy (config);
}
int
@@ -180,7 +172,7 @@ main (int argc, char *argv[])
g_file_get_contents (argv[1], &contents, &length, &error);
g_assert_no_error (error);
orig = g_bytes_new_take (contents, length);
- context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ context = pango_font_map_create_context (map);
layout = pango_layout_deserialize (context, orig, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
g_assert_no_error (error);