summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-03-15 02:48:56 +0000
committerMatthias Clasen <mclasen@redhat.com>2022-03-15 02:48:56 +0000
commitf9d0b6da8f4ad1a285d462ae381d861738d0ced1 (patch)
treec143b87c67c86e1a4ec7e23f4f7f84a1c9145b4a
parent60c4f9d5f967faa3ffac8f72de3b943d69c3310d (diff)
parent2d0287de702cba1ae624fb88fd87036840e7081f (diff)
downloadpango-f9d0b6da8f4ad1a285d462ae381d861738d0ced1.tar.gz
Merge branch 'matthiasc/for-main' into 'main'
Fix test font configuration See merge request GNOME/pango!601
-rw-r--r--tests/fonts/fonts.conf4
-rw-r--r--tests/fontsets/cantarell11
-rw-r--r--tests/fontsets/cantarell211
-rw-r--r--tests/fontsets/mono11
-rw-r--r--tests/fontsets/mono211
-rw-r--r--tests/layouts/aaa.layout38
-rw-r--r--tests/layouts/tab-crash.layout252
-rw-r--r--tests/meson.build9
-rw-r--r--tests/test-fonts.c233
9 files changed, 433 insertions, 147 deletions
diff --git a/tests/fonts/fonts.conf b/tests/fonts/fonts.conf
index 4308770b..15685421 100644
--- a/tests/fonts/fonts.conf
+++ b/tests/fonts/fonts.conf
@@ -64,8 +64,8 @@
</alias>
<alias>
- <family>DejaVu Sans Mono</family>
- <default><family>monospace</family></default>
+ <family>monospace</family>
+ <prefer><family>DejaVu Sans Mono</family></prefer>
</alias>
</fontconfig>
diff --git a/tests/fontsets/cantarell b/tests/fontsets/cantarell
new file mode 100644
index 00000000..ed9e4251
--- /dev/null
+++ b/tests/fontsets/cantarell
@@ -0,0 +1,11 @@
+Cantarell 11
+
+Cantarell 11
+DejaVu Sans 11
+DejaVu Sans Mono 11
+Noto Sans CJK JP 11
+Droid Sans Japanese 11
+Amiri 11
+DejaVu Sans Bold 11
+Font Awesome 5 Free Solid Heavy 11
+Noto Color Emoji 11
diff --git a/tests/fontsets/cantarell2 b/tests/fontsets/cantarell2
new file mode 100644
index 00000000..2c86ec8f
--- /dev/null
+++ b/tests/fontsets/cantarell2
@@ -0,0 +1,11 @@
+Cantarell Bold 11
+
+Cantarell Bold 11
+DejaVu Sans Bold 11
+Font Awesome 5 Free Solid Heavy 11
+DejaVu Sans 11
+DejaVu Sans Mono 11
+Noto Sans CJK JP 11
+Droid Sans Japanese 11
+Amiri 11
+Noto Color Emoji 11
diff --git a/tests/fontsets/mono b/tests/fontsets/mono
new file mode 100644
index 00000000..f6a735a5
--- /dev/null
+++ b/tests/fontsets/mono
@@ -0,0 +1,11 @@
+Monospace 20
+
+DejaVu Sans Mono 20
+DejaVu Sans 20
+Noto Sans CJK JP 20
+Droid Sans Japanese 20
+Cantarell 20
+Amiri 20
+DejaVu Sans Bold 20
+Font Awesome 5 Free Solid Heavy 20
+Noto Color Emoji 20
diff --git a/tests/fontsets/mono2 b/tests/fontsets/mono2
new file mode 100644
index 00000000..6f999cb7
--- /dev/null
+++ b/tests/fontsets/mono2
@@ -0,0 +1,11 @@
+monospace 20
+
+DejaVu Sans Mono 20
+DejaVu Sans 20
+Noto Sans CJK JP 20
+Droid Sans Japanese 20
+Cantarell 20
+Amiri 20
+DejaVu Sans Bold 20
+Font Awesome 5 Free Solid Heavy 20
+Noto Color Emoji 20
diff --git a/tests/layouts/aaa.layout b/tests/layouts/aaa.layout
index 829e74c8..08f86a8c 100644
--- a/tests/layouts/aaa.layout
+++ b/tests/layouts/aaa.layout
@@ -15,7 +15,7 @@
]
},
"text" : "aaaa ",
- "font" : "Monospace 32",
+ "font" : "monospace 32",
"wrap" : "char",
"width" : 0,
"line-spacing" : 1.2999999523162842,
@@ -23,7 +23,7 @@
"is-wrapped" : true,
"is-ellipsized" : false,
"unknown-glyphs" : 0,
- "width" : 41984,
+ "width" : 53248,
"height" : 318464,
"log-attrs" : [
{
@@ -85,8 +85,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 32",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 32",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -108,8 +108,8 @@
"log-cluster" : 0
},
{
- "glyph" : 2803,
- "width" : 15360,
+ "glyph" : 1819,
+ "width" : 26624,
"log-cluster" : 0
}
]
@@ -131,8 +131,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 32",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 32",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -154,8 +154,8 @@
"log-cluster" : 0
},
{
- "glyph" : 2803,
- "width" : 15360,
+ "glyph" : 1819,
+ "width" : 26624,
"log-cluster" : 0
}
]
@@ -177,8 +177,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 32",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 32",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -200,8 +200,8 @@
"log-cluster" : 0
},
{
- "glyph" : 2803,
- "width" : 15360,
+ "glyph" : 1819,
+ "width" : 26624,
"log-cluster" : 0
}
]
@@ -223,8 +223,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 32",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 32",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -264,8 +264,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 32",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 32",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -282,7 +282,7 @@
"glyphs" : [
{
"glyph" : 3,
- "width" : 14336,
+ "width" : 26624,
"is-cluster-start" : true,
"log-cluster" : 0
}
diff --git a/tests/layouts/tab-crash.layout b/tests/layouts/tab-crash.layout
index 3fb0ab54..9bcb114b 100644
--- a/tests/layouts/tab-crash.layout
+++ b/tests/layouts/tab-crash.layout
@@ -39,7 +39,7 @@
"is-wrapped" : true,
"is-ellipsized" : false,
"unknown-glyphs" : 0,
- "width" : 585728,
+ "width" : 552960,
"height" : 58368,
"log-attrs" : [
{
@@ -599,8 +599,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -617,7 +617,7 @@
"glyphs" : [
{
"glyph" : 76,
- "width" : 4096,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 0
},
@@ -629,7 +629,7 @@
},
{
"glyph" : 32,
- "width" : 13312,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 2
},
@@ -641,67 +641,67 @@
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 4
},
{
"glyph" : 56,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 5
},
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 6
},
{
"glyph" : 44,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 7
},
{
"glyph" : 50,
- "width" : 13312,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 8
},
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 9
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 10
},
{
"glyph" : 36,
- "width" : 11264,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 11
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 12
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 13
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 14
},
@@ -719,7 +719,7 @@
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 17
},
@@ -731,7 +731,7 @@
},
{
"glyph" : 38,
- "width" : 11264,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 19
},
@@ -743,103 +743,103 @@
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 21
},
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 22
},
{
"glyph" : 56,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 23
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 24
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 25
},
{
"glyph" : 15,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 26
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 27
},
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 28
},
{
"glyph" : 56,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 29
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 30
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 31
},
{
"glyph" : 15,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 32
},
{
"glyph" : 3,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 33
},
{
"glyph" : 38,
- "width" : 11264,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 34
},
{
"glyph" : 50,
- "width" : 13312,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 35
},
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 36
},
{
"glyph" : 38,
- "width" : 11264,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 37
},
@@ -857,7 +857,7 @@
},
{
"glyph" : 11,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 40
},
@@ -869,7 +869,7 @@
},
{
"glyph" : 91,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 42
},
@@ -935,7 +935,7 @@
},
{
"glyph" : 15,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 53
},
@@ -951,21 +951,21 @@
},
{
"start-index" : 55,
- "length" : 37,
+ "length" : 25,
"paragraph-start" : false,
"direction" : "ltr",
"runs" : [
{
"offset" : 55,
- "length" : 31,
- "text" : "0x73323173656374657374), NULL--",
+ "length" : 25,
+ "text" : "0x73323173656374657374), ",
"bidi-level" : 0,
"gravity" : "south",
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -988,7 +988,7 @@
},
{
"glyph" : 91,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 1
},
@@ -1114,57 +1114,92 @@
},
{
"glyph" : 12,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 22
},
{
"glyph" : 15,
- "width" : 5120,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 23
},
{
- "glyph" : 3,
- "width" : 5120,
+ "glyph" : 268435455,
+ "width" : 0,
"is-cluster-start" : true,
"log-cluster" : 24
- },
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "start-index" : 80,
+ "length" : 20,
+ "paragraph-start" : false,
+ "direction" : "ltr",
+ "runs" : [
+ {
+ "offset" : 80,
+ "length" : 6,
+ "text" : "NULL--",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "latin",
+ "font" : {
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
+ "matrix" : [
+ 1,
+ -0,
+ -0,
+ 1,
+ 0,
+ 0
+ ]
+ },
+ "flags" : 0,
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
{
"glyph" : 49,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 25
+ "log-cluster" : 0
},
{
"glyph" : 56,
- "width" : 12288,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 26
+ "log-cluster" : 1
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 27
+ "log-cluster" : 2
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 28
+ "log-cluster" : 3
},
{
"glyph" : 16,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 29
+ "log-cluster" : 4
},
{
"glyph" : 16,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 30
+ "log-cluster" : 5
}
]
},
@@ -1177,8 +1212,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -1195,7 +1230,7 @@
"glyphs" : [
{
"glyph" : 268435455,
- "width" : 31744,
+ "width" : 20480,
"is-cluster-start" : true,
"log-cluster" : 0
}
@@ -1210,8 +1245,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -1243,8 +1278,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -1276,8 +1311,8 @@
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -1302,15 +1337,15 @@
},
{
"offset" : 90,
- "length" : 2,
- "text" : "--",
+ "length" : 10,
+ "text" : "-->(MYSQL)",
"bidi-level" : 0,
"gravity" : "south",
"language" : "en-us",
"script" : "latin",
"font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "description" : "DejaVu Sans Mono 12",
+ "checksum" : "84c5467cadd1f6f23db0d9fbb6377e0d301334d3b5f36e6d5acebd34d0857d3a",
"matrix" : [
1,
-0,
@@ -1327,98 +1362,63 @@
"glyphs" : [
{
"glyph" : 16,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 0
},
{
"glyph" : 16,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
"log-cluster" : 1
- }
- ]
- }
- ]
- },
- {
- "start-index" : 92,
- "length" : 8,
- "paragraph-start" : false,
- "direction" : "ltr",
- "runs" : [
- {
- "offset" : 92,
- "length" : 8,
- "text" : ">(MYSQL)",
- "bidi-level" : 0,
- "gravity" : "south",
- "language" : "en-us",
- "script" : "latin",
- "font" : {
- "description" : "DejaVu Sans 12",
- "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
- "matrix" : [
- 1,
- -0,
- -0,
- 1,
- 0,
- 0
- ]
- },
- "flags" : 0,
- "y-offset" : 0,
- "start-x-offset" : 0,
- "end-x-offset" : 0,
- "glyphs" : [
+ },
{
"glyph" : 33,
- "width" : 13312,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 0
+ "log-cluster" : 2
},
{
"glyph" : 11,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 1
+ "log-cluster" : 3
},
{
"glyph" : 48,
- "width" : 14336,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 2
+ "log-cluster" : 4
},
{
"glyph" : 60,
"width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 3
+ "log-cluster" : 5
},
{
"glyph" : 54,
"width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 4
+ "log-cluster" : 6
},
{
"glyph" : 52,
- "width" : 13312,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 5
+ "log-cluster" : 7
},
{
"glyph" : 47,
- "width" : 9216,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 6
+ "log-cluster" : 8
},
{
"glyph" : 12,
- "width" : 6144,
+ "width" : 10240,
"is-cluster-start" : true,
- "log-cluster" : 7
+ "log-cluster" : 9
}
]
}
diff --git a/tests/meson.build b/tests/meson.build
index 84fe3370..955dbc99 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -62,6 +62,7 @@ if cairo_dep.found()
if host_system != 'darwin'
tests += [
[ 'test-layout', [ 'test-layout.c', 'test-common.c' ], [ libpangocairo_dep, libpangoft2_dep ] ],
+ [ 'test-fonts', [ 'test-fonts.c', 'test-common.c' ], [ libpangocairo_dep, libpangoft2_dep ] ],
]
endif
endif
@@ -127,6 +128,13 @@ installed_test_layouts_data = [
'layouts/letterspacing.layout',
]
+installed_test_fontsets_data = [
+ 'fontsets/cantarell',
+ 'fontsets/cantarell2',
+ 'fontsets/mono',
+ 'fontsets/mono2',
+]
+
installed_test_fonts_data = [
'fonts/amiri-06dd.ttf',
'fonts/Cantarell-VF.otf',
@@ -251,6 +259,7 @@ if get_option('install-tests')
install_data(installed_test_markups_data, install_dir: join_paths(installed_test_bindir, 'markups'))
install_data(installed_test_breaks_data, install_dir: join_paths(installed_test_bindir, 'breaks'))
install_data(installed_test_items_data, install_dir: join_paths(installed_test_bindir, 'itemize'))
+ install_data(installed_test_fontsets_data, install_dir: join_paths(installed_test_bindir, 'fontsets'))
endif
gen_installed_test = files([ 'gen-installed-test.py' ])
diff --git a/tests/test-fonts.c b/tests/test-fonts.c
new file mode 100644
index 00000000..918a816b
--- /dev/null
+++ b/tests/test-fonts.c
@@ -0,0 +1,233 @@
+#include <string.h>
+#include <locale.h>
+
+#include <pango/pango.h>
+#include <pango/pangocairo-fc.h>
+#include <pango/pangofc-fontmap.h>
+#include "test-common.h"
+
+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);
+ 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);
+ FcConfigDestroy (config);
+
+ pango_cairo_font_map_set_default (PANGO_CAIRO_FONT_MAP (map));
+
+ g_object_unref (map);
+}
+
+static gboolean
+append_one (PangoFontset *fonts,
+ PangoFont *font,
+ gpointer data)
+{
+ PangoFontDescription *desc;
+ GString *str = data;
+ char *s;
+
+ desc = pango_font_describe (font);
+ s = pango_font_description_to_string (desc);
+
+ g_string_append_printf (str, "%s\n", s);
+
+ g_free (s);
+ pango_font_description_free (desc);
+
+ return FALSE;
+}
+
+static char *
+list_fonts (const char *contents)
+{
+ char *p, *s;
+ PangoFontDescription *desc;
+ PangoContext *context;
+ PangoFontset *fonts;
+ GString *str;
+
+ p = strchr (contents, '\n');
+ if (p)
+ s = g_strndup (contents, p - contents);
+ else
+ s = g_strdup (contents);
+
+ desc = pango_font_description_from_string (s);
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ fonts = pango_context_load_fontset (context, desc, pango_language_get_default ());
+
+ str = g_string_new (s);
+ g_string_append (str, "\n\n");
+
+ pango_fontset_foreach (fonts, append_one, str);
+
+ g_object_unref (fonts);
+ g_object_unref (context);
+ pango_font_description_free (desc);
+
+ g_free (s);
+
+ return g_string_free (str, FALSE);
+}
+
+static void
+test_fontset (gconstpointer d)
+{
+ const char *filename = d;
+ GError *error = NULL;
+ char *diff;
+ GBytes *bytes;
+ char *contents;
+ gsize length;
+ char *s;
+ GBytes *orig;
+
+ if (!PANGO_IS_FC_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)
+ {
+ char *msg = g_strdup_printf ("Locale en_US.UTF-8 not available, skipping layout %s", filename);
+ g_test_skip (msg);
+ g_free (msg);
+ g_free (old_locale);
+ return;
+ }
+
+ g_file_get_contents (filename, &contents, &length, &error);
+ g_assert_no_error (error);
+
+ s = list_fonts (contents);
+
+ orig = g_bytes_new_take (contents, length);
+ bytes = g_bytes_new_take (s, strlen (s));
+
+ diff = diff_bytes (orig, bytes, &error);
+ g_assert_no_error (error);
+
+ g_bytes_unref (bytes);
+ g_bytes_unref (orig);
+
+ setlocale (LC_ALL, old_locale);
+ g_free (old_locale);
+
+ if (diff && diff[0])
+ {
+ char **lines = g_strsplit (diff, "\n", -1);
+ const char *line;
+ int i = 0;
+
+ g_test_message ("Contents don't match expected contents");
+
+ for (line = lines[0]; line != NULL; line = lines[++i])
+ g_test_message ("%s", line);
+
+ g_test_fail ();
+ g_strfreev (lines);
+ }
+
+ g_free (diff);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GDir *dir;
+ GError *error = NULL;
+ char *opt_fonts = NULL;
+ const gchar *name;
+ char *path;
+ GOptionContext *option_context;
+ GOptionEntry entries[] = {
+ { "fonts", 0, 0, G_OPTION_ARG_FILENAME, &opt_fonts, "Fonts to use", "DIR" },
+ { NULL, 0 },
+ };
+
+ 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);
+ if (!g_option_context_parse (option_context, &argc, &argv, &error))
+ {
+ g_error ("failed to parse options: %s", error->message);
+ return 1;
+ }
+ g_option_context_free (option_context);
+
+ if (opt_fonts)
+ {
+ install_fonts (opt_fonts);
+ g_free (opt_fonts);
+ }
+
+ /* allow to easily generate expected output for new test cases */
+ if (argc > 1 && argv[1][0] != '-')
+ {
+ char *contents;
+ gsize length;
+ GError *error = NULL;
+ char *s;
+
+ g_file_get_contents (argv[1], &contents, &length, &error);
+ g_assert_no_error (error);
+
+ s = list_fonts (contents);
+
+ g_print ("%s", s);
+
+ g_free (s);
+ g_free (contents);
+
+ return 0;
+ }
+
+ g_test_init (&argc, &argv, NULL);
+
+ if (!opt_fonts)
+ {
+ path = g_test_build_filename (G_TEST_DIST, "fonts", NULL);
+ install_fonts (path);
+ g_free (path);
+ }
+
+ path = g_test_build_filename (G_TEST_DIST, "fontsets", NULL);
+ dir = g_dir_open (path, 0, &error);
+ g_free (path);
+ g_assert_no_error (error);
+ while ((name = g_dir_read_name (dir)) != NULL)
+ {
+ path = g_strdup_printf ("/fontsets/%s", name);
+ g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DIST, "fontsets", name, NULL),
+ test_fontset, g_free);
+ g_free (path);
+ }
+ g_dir_close (dir);
+
+ return g_test_run ();
+}