[pango/simple-fontmap: 2/4] test-shape: Use a simple fontmap




commit 17545cee307b5937ab22762001ac3bfa65a66878
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 27 22:43:49 2021 -0400

    test-shape: Use a simple fontmap
    
    This is experimental to see how far we can take this.

 tests/test-shape.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-shape.c b/tests/test-shape.c
index a16eb9d7..03031597 100644
--- a/tests/test-shape.c
+++ b/tests/test-shape.c
@@ -33,7 +33,7 @@
 #include <pango/pangocairo.h>
 #include "test-common.h"
 
-
+static PangoSimpleFontMap *fontmap;
 static PangoContext *context;
 
 gboolean opt_hex_chars;
@@ -196,6 +196,9 @@ test_file (const gchar *filename, GString *string)
       PangoGlyphItem glyph_item;
       int i;
 
+      g_assert_nonnull (item->analysis.font);
+      g_assert_true (strcmp (G_OBJECT_TYPE_NAME (item->analysis.font), "PangoHbFont") == 0);
+
       glyphs = pango_glyph_string_new ();
       /* FIXME: get log attrs */
       pango_shape_item (item, text, length, NULL, glyphs, 0);
@@ -401,7 +404,10 @@ main (int argc, char *argv[])
 
   g_test_init (&argc, &argv, NULL);
 
-  context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+  fontmap = pango_simple_font_map_new ();
+  pango_simple_font_map_add_file (fontmap, "/usr/share/fonts/cantarell/Cantarell-Regular.otf", 0);
+
+  context = pango_font_map_create_context (PANGO_FONT_MAP (fontmap));
 
   /* allow to easily generate expected output for new test cases */
   if (argc > 1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]