summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fcmatch.c2
-rw-r--r--test/Makefile.am1
-rw-r--r--test/run-test-conf.sh6
-rw-r--r--test/test-conf.c18
-rw-r--r--test/test-style-match.json31
5 files changed, 56 insertions, 2 deletions
diff --git a/src/fcmatch.c b/src/fcmatch.c
index 53c3b0e..c88e3aa 100644
--- a/src/fcmatch.c
+++ b/src/fcmatch.c
@@ -433,7 +433,7 @@ FcCompareValueList (FcObject object,
*result = FcResultTypeMismatch;
return FcFalse;
}
- v = v * 1000 + j;
+ v = v * 1000 + j * 100 + k;
if (v < best)
{
if (bestValue)
diff --git a/test/Makefile.am b/test/Makefile.am
index 2117ef0..aea8724 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -47,6 +47,7 @@ TESTDATA = \
test-45-generic.json \
test-60-generic.json \
test-90-synthetic.json \
+ test-style-match.json \
$(NULL)
if FREETYPE_PCF_LONG_FAMILY_NAMES
diff --git a/test/run-test-conf.sh b/test/run-test-conf.sh
index 6fad983..0c2bd52 100644
--- a/test/run-test-conf.sh
+++ b/test/run-test-conf.sh
@@ -48,3 +48,9 @@ for i in \
echo $RUNNER $TESTDIR/../conf.d/$i $TESTDIR/$test_json
$RUNNER $TESTDIR/../conf.d/$i $TESTDIR/$test_json
done
+for i in \
+ test-style-match.json \
+ ; do
+ echo $RUNNER $TESTDIR/$i ...
+ $RUNNER $TESTDIR/../conf.d/10-autohint.conf $TESTDIR/$i
+done
diff --git a/test/test-conf.c b/test/test-conf.c
index 4959f76..e4e9da4 100644
--- a/test/test-conf.c
+++ b/test/test-conf.c
@@ -166,6 +166,21 @@ build_pattern (json_object *obj)
continue;
}
}
+ } else if (fc_o && fc_o->type == FcTypeString) {
+ for (i = 0; i < n; i++)
+ {
+ o = json_object_array_get_idx (iter.val, i);
+ type = json_object_get_type (o);
+ if (type != json_type_string) {
+ fprintf (stderr, "E: unable to convert to string\n");
+ continue;
+ }
+ v.type = FcTypeString;
+ v.u.s = (const FcChar8 *) json_object_get_string (o);
+ FcPatternAdd (pat, iter.key, v, FcTrue);
+ v.type = FcTypeVoid;
+ }
+ continue;
} else {
FcLangSet* ls = FcLangSetCreate ();
if (!ls) {
@@ -232,7 +247,8 @@ build_pattern (json_object *obj)
fprintf (stderr, "W: unexpected object to build a pattern: (%s %s)", iter.key, json_type_to_name (json_object_get_type (iter.val)));
continue;
}
- FcPatternAdd (pat, iter.key, v, FcTrue);
+ if (v.type != FcTypeVoid)
+ FcPatternAdd (pat, iter.key, v, FcTrue);
if (destroy_v)
FcValueDestroy (v);
}
diff --git a/test/test-style-match.json b/test/test-style-match.json
new file mode 100644
index 0000000..bb60d16
--- /dev/null
+++ b/test/test-style-match.json
@@ -0,0 +1,31 @@
+{
+ "fonts": [
+ {
+ "family": [ "Foo", "Foo Caption" ],
+ "style": [ "Caption", "Regular" ],
+ "file": "/path/to/Foo-Capt.ttf",
+ "fontversion": 133365
+ },
+ {
+ "family": "Foo",
+ "style": "Regular",
+ "file": "/path/to/Foo-Regular.ttf",
+ "fontversion": 133365
+ }
+ ],
+ "tests": [
+ {
+ "method": "match",
+ "query": {
+ "family": "Foo",
+ "style": "Regular"
+ },
+ "result": {
+ "family": "Foo",
+ "style": "Regular",
+ "file": "/path/to/Foo-Regular.ttf",
+ "fontversion": 133365
+ }
+ }
+ ]
+}