[pango/pango2: 162/195] test-layout: port to PangoFcHbFontMap
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 162/195] test-layout: port to PangoFcHbFontMap
- Date: Mon, 6 Jun 2022 04:14:45 +0000 (UTC)
commit 925526c2b37e42d1e1666f98ed5dc9ac1d1420b1
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 13 09:12:28 2022 -0400
test-layout: port to PangoFcHbFontMap
tests/test-layout.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/tests/test-layout.c b/tests/test-layout.c
index f440952b..667e5c2f 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,12 +104,11 @@ 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);
+ map = PANGO_FONT_MAP (pango_fc_hb_font_map_new ());
config = FcConfigCreate ();
@@ -127,12 +122,8 @@ 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);
+ pango_fc_hb_font_map_set_config (PANGO_FC_HB_FONT_MAP (map), config);
FcConfigDestroy (config);
-
- pango_cairo_font_map_set_default (PANGO_CAIRO_FONT_MAP (map));
-
- g_object_unref (map);
}
int
@@ -180,7 +171,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]