| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
import sys, fontforge |
| 5 |
|
| 6 |
plain = 'Comment without em-dash' |
| 7 |
uni = u'Comment with — em dash' |
| 8 |
|
| 9 |
f=fontforge.open(sys.argv[1]) |
| 10 |
|
| 11 |
g=f['dcroat'] |
| 12 |
if g.comment != "": |
| 13 |
raise ValueError("Expected comment to start as empty string") |
| 14 |
|
| 15 |
g.comment = plain |
| 16 |
if g.comment != plain: |
| 17 |
raise ValueError("Unable to assign and read plain ASCII comment") |
| 18 |
|
| 19 |
g.comment = uni |
| 20 |
if g.comment != uni: |
| 21 |
raise ValueError("Unable to assign and read plain ASCII comment") |
| 22 |
|
| 23 |
lname = '\'=>\' Single Substitution' |
| 24 |
|
| 25 |
|
| 26 |
flags = ('right_to_left', 'ignore_bases') |
| 27 |
fealist = (("liga",(("latn",("dflt")),)),) |
| 28 |
|
| 29 |
f.addLookup(lname, 'gsub_single', flags, fealist) |
| 30 |
f.addLookupSubtable(lname, lname) |
| 31 |
|
| 32 |
g.addPosSub(lname,'LIG') |
| 33 |
tup = g.getPosSub(lname) |
| 34 |
if not (tup[0][0] == lname and tup[0][2] == 'LIG'): |
| 35 |
raise ValueError("Unable to assign and read plain ASCII PosSub") |
| 36 |
|
| 37 |
dcroat_tti = b"@2\x1e\x04\x10\x1d\x03!\x00\x19\x13z\x1b\x11!\x94\r'\x94\x07\x15z\x17q\x00z\x07`\r\x8c\x02\x12$\x16,\x1d\x14\x10\x03\x03'\x1a\x01,\x18\x005$\x1a\n**\x10\xf4\xec\xf4<\xe42\xfc\x17<\xe4\x1191\x00/\xec\xe4\xec\xfc\xec\x10\xee\x10\xee\xd5<\xee2\x11\x12\x17990@\t\x00+\x10+\x7f+\xb0+\x04\x01]" |
| 38 |
|
| 39 |
if g.ttinstrs != dcroat_tti: |
| 40 |
raise ValueError("Unexpected ttinstrs in glyph dcroat") |
| 41 |
|
| 42 |
tbaseline = (("hang","ideo","romn"), |
| 43 |
(("cyrl","romn",(1405,-288,0),()), |
| 44 |
("grek","romn",(1405,-288,0),()), |
| 45 |
("latn","romn",(1405,-288,0), |
| 46 |
(("dflt",-576,1913, |
| 47 |
(("NoAc",-576,1482), ("ENG ",-576,1482)) |
| 48 |
),) |
| 49 |
) |
| 50 |
) |
| 51 |
) |
| 52 |
|
| 53 |
if f.horizontalBaseline != None: |
| 54 |
raise ValueError("Unexpected horizontalBaseline") |
| 55 |
f.horizontalBaseline = tbaseline |
| 56 |
if f.horizontalBaseline != tbaseline: |
| 57 |
raise ValueError("Unable to assign and read font baseline") |
| 58 |
|
| 59 |
vrs = (f['a'], f['b'], f['c']) |
| 60 |
|
| 61 |
if g.verticalVariants != None: |
| 62 |
raise ValueError("Unexpected verticalVariants") |
| 63 |
g.verticalVariants = vrs |
| 64 |
if g.verticalVariants != 'a b c': |
| 65 |
raise ValueError("Unable to assign and read glyph verticalVariants") |