[pango/pango2: 17/118] test-layout: port to PangoFcHbFontMap
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 17/118] test-layout: port to PangoFcHbFontMap
- Date: Tue, 14 Jun 2022 01:34:20 +0000 (UTC)
commit 06c948597a61841d4d00cdd45e51330b0ecc6245
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 13 09:12:28 2022 -0400
test-layout: port to PangoFcHbFontMap
tests/test-layout.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/tests/test-layout.c b/tests/test-layout.c
index f440952bd..b42f8f938 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]