[pango/font-serialize-test: 4/7] tests: Fix font setup for Emoji
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/font-serialize-test: 4/7] tests: Fix font setup for Emoji
- Date: Sat, 27 Nov 2021 14:23:23 +0000 (UTC)
commit 99d6b3fc3c5eb96b836a5ce934e6628c4217d623
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 26 23:03:16 2021 -0500
tests: Fix font setup for Emoji
We need to copy the scale hack for bitmaps.
tests/fonts/fonts.conf | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/test-layout.c | 11 ++++-----
2 files changed, 70 insertions(+), 6 deletions(-)
---
diff --git a/tests/fonts/fonts.conf b/tests/fonts/fonts.conf
new file mode 100644
index 00000000..5ff7022b
--- /dev/null
+++ b/tests/fonts/fonts.conf
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
+<fontconfig>
+ <cachedir>/tmp/cache</cachedir>
+
+ <match target="font">
+ <test name="outline" compare="eq">
+ <bool>false</bool>
+ </test>
+ <edit name="pixelsizefixupfactor" mode="assign">
+ <divide>
+ <name target="pattern">pixelsize</name>
+ <name target="font">pixelsize</name>
+ </divide>
+ </edit>
+ </match>
+
+ <match target="font">
+ <test name="outline" compare="eq">
+ <bool>false</bool>
+ </test>
+ <test name="pixelsizefixupfactor" compare="not_eq">
+ <double>1.0</double>
+ </test>
+ <edit name="matrix" mode="assign">
+ <times>
+ <name>matrix</name>
+ <matrix>
+ <name>pixelsizefixupfactor</name> <double>0</double>
+ <double>0</double> <name>pixelsizefixupfactor</name>
+ </matrix>
+ </times>
+ </edit>
+ <edit name="size" mode="assign">
+ <divide>
+ <name>size</name>
+ <name>pixelsizefixupfactor</name>
+ </divide>
+ </edit>
+ </match>
+
+ <alias binding="same">
+ <family>Noto Color Emoji</family>
+ <default><family>emoji</family></default>
+ </alias>
+
+ <match>
+ <test name="lang">
+ <string>und-zsye</string>
+ </test>
+ <test qual="all" name="family" compare="not_eq">
+ <string>emoji</string>
+ </test>
+ <edit name="family" mode="append" binding="strong">
+ <string>emoji</string>
+ </edit>
+ </match>
+
+ <alias binding="same">
+ <family>emoji</family>
+ <prefer>
+ <family>Noto Color Emoji</family>
+ </prefer>
+ </alias>
+</fontconfig>
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 62aba460..3ea3063d 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -109,22 +109,22 @@ 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 ();
- conf = g_strdup_printf ("<?xml version=\"1.0\"?>\n"
- "<!DOCTYPE fontconfig SYSTEM \"urn:fontconfig:fonts.dtd\">\n"
- "<fontconfig>\n"
- " <cachedir>%s/cache</cachedir>\n"
- "</fontconfig>", dir);
+ path = g_test_build_filename (G_TEST_DIST, "fonts/fonts.conf", NULL);
+ g_file_get_contents (path, &conf, &len, NULL);
if (!FcConfigParseAndLoadFromMemory (config, (const FcChar8 *) conf, TRUE))
g_error ("Failed to parse fontconfig configuration");
g_free (conf);
+ g_free (path);
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (map), config);
@@ -150,7 +150,6 @@ main (int argc, char *argv[])
};
setlocale (LC_ALL, "");
-
option_context = g_option_context_new ("");
g_option_context_add_main_entries (option_context, entries, NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]