[test/shape] Allow comments in directives

Also adjust tests for directwrite font-funcs.
This commit is contained in:
Behdad Esfahbod committed 2025-03-17 21:05:21 -06:00
1 parent 27bb37c5d0
commit 719dafdaad
4 files changed
+14 -4

No files matched your search

@@ -1,4 +1,4 @@
@font-funcs=ot,ft,directwrite,uniscribe
@font-funcs=ot,ft
../fonts/df768b9c257e0c9c35786c47cae15c46571d56be.ttf;;U+0633,U+064F,U+0644,U+064E,U+0651,U+0627,U+0651,U+0650,U+0645,U+062A,U+06CC;[uni06CC.fina=10+1655|uni062A.medi=9+868|uni0645.init=8+1098|uni0650=2@148,0+0|uni0651=2@187,736+0|uni064E=2@883,1259+0|uni0651=2@922,736+0|uni06440627.fina=2+1470|uni064F=0@629,-10+0|uni0633.init=0+1585]
../fonts/SimpArabicTest.ttf;--no-positions;U+0628,U+0650,U+0633,U+0652,U+0645,U+0650,U+0020,U+0020,U+0627,U+0644,U+0644,U+0647,U+0020,U+0627,U+0644,U+0631,U+0651,U+064E,U+062D,U+0652,U+0645,U+064E,U+0646,U+0650,U+0020,U+0627,U+0644,U+0631,U+062D,U+0650,U+064A,U+0645;[daggerdbl=31|c142=30|twosuperior=28|bracketleft=28|c=27|quotedblbase=26|J=25|parenright=24|twosuperior=22|Eacute=22|logicalnot=20|dagger=20|registered=18|bracketleft=18|logicalnot=15|plusminus=15|c=15|quotedblbase=14|J=13|parenright=12|guilsinglleft=11|quotedblbase=10|quotedblbase=9|J=8|parenright=7|parenright=6|twosuperior=4|daggerdbl=4|registered=2|j=2|twosuperior=0|R=0]
../fonts/SimpArabicTest.ttf;;U+0020,U+0644,U+0627,U+0020,U+0644,U+0623,U+0020,U+0644,U+064E,U+0623,U+064E,U+0020,U+0623,U+064E,U+0646,U+062A;[U=15+693|DEL=14+227|logicalnot=12@17,307+0|L=12+289|parenright=11+391|logicalnot=7@41,267+0|logicalnot=7@378,267+0|brokenbar=7+674|parenright=6+391|brokenbar=4+674|parenright=3+391|yen=1+709|parenright=0+391]
@@ -1,3 +1,3 @@
@font-funcs=ot,ft
@font-funcs=ot,ft # hb-fontations seems to infinite-loop
../fonts/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf;--show-extents;U+1F42F;[gid1=0+2963<0,2179,2963,-2789>]
../fonts/fcbaa518d3cce441ed37ae3b1fed6a19e9b54efd.ttf;--show-extents;U+1F600;[gid4=0+2550<0,1898,2555,-2405>]
@@ -1,3 +1,4 @@
@font-funcs-=directwrite # hb-directwrite doe not support variations yet
../fonts/HBTest-VF.ttf;--variations=TEST=491;U+0041;[A=0+496]
../fonts/HBTest-VF.ttf;--variations=TEST=509;U+0041;[A=0+505]
../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf;--variations=wdth=60;U+0020;[space=0+266]
+11 -2
View File
@@ -132,9 +132,12 @@ for filename in args:
if line.startswith("@"):
# Directive
line = line.strip()
line = line.split("#")[0].strip()[1:]
consumed = False
for what in ["shaper", "face-loader", "font-funcs"]:
whats = plural(what)
if line.startswith("@" + whats):
if line.startswith(whats):
command, values = line.split("=")
values = values.strip().split(",")
@@ -149,7 +152,13 @@ for filename in args:
var_name = all_whats_var_name(what)
print(f"Setting {var_name} to {values}")
globals()[var_name] = values
continue
consumed = True
if consumed:
print(line)
continue
else:
print("Unrecognized directive: %s" % line)
sys.exit(1)
fontfile, options, unicodes, glyphs_expected = line.split(";")
options = options.split()