[librsvg] Allow having more than one font for the testing machinery



commit 8bb9f95be4b086a389b3642fa843a5f8d625a977
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 6 18:18:57 2017 -0600

    Allow having more than one font for the testing machinery
    
    We only have one right now, but we'll want to have more font files, to
    allow testing bold/italic/right-to-left, etc.

 rsvg-cairo-draw.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index b9c326f..226cd11 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -158,15 +158,21 @@ set_font_options_for_testing (PangoContext *context)
 static void
 create_font_config_for_testing (RsvgCairoRender *render)
 {
-    const char *font_path = SRCDIR "/tests/resources/LiberationSans-Regular.ttf";
+    const char *font_paths[] = {
+        SRCDIR "/tests/resources/LiberationSans-Regular.ttf",
+    };
+
+    int i;
 
     if (render->font_config_for_testing != NULL)
         return;
 
     render->font_config_for_testing = FcConfigCreate ();
 
-    if (!FcConfigAppFontAddFile (render->font_config_for_testing, (const FcChar8 *) font_path)) {
-        g_error ("Could not load font file \"%s\" for tests; aborting", font_path);
+    for (i = 0; i < G_N_ELEMENTS(font_paths); i++) {
+        if (!FcConfigAppFontAddFile (render->font_config_for_testing, (const FcChar8 *) font_paths[i])) {
+            g_error ("Could not load font file \"%s\" for tests; aborting", font_paths[i]);
+        }
     }
 }
 


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