| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
import sys, fontforge |
| 5 |
|
| 6 |
ambrosia = sys.argv[1] |
| 7 |
font = fontforge.open(ambrosia) |
| 8 |
|
| 9 |
assert font.math.MathLeadingDeviceTable == {} |
| 10 |
|
| 11 |
|
| 12 |
for adjustments in [ |
| 13 |
{9: -1, 10: -1, 12: -1}, |
| 14 |
{9: -1, 10: -1, 12: -1}, |
| 15 |
{9: -1, 10: -1}, |
| 16 |
{9: -1, 10: -1, 14: -1, 18: -1}, |
| 17 |
{9: 1, 10: -2, 12: 0, 18: -3}, |
| 18 |
{9: 1, 12: 0, 18: -3, 10: -2}, |
| 19 |
{}, |
| 20 |
{} |
| 21 |
]: |
| 22 |
font.math.MathLeadingDeviceTable = adjustments |
| 23 |
|
| 24 |
non_zero_adjustments = {k:v for (k,v) in adjustments.items() if v != 0} |
| 25 |
assert font.math.MathLeadingDeviceTable == non_zero_adjustments |
| 26 |
assert len(font.math.MathLeadingDeviceTable) == len(non_zero_adjustments) |
| 27 |
|
| 28 |
|
| 29 |
font.math.AxisHeightDeviceTable = {10: -1} |
| 30 |
|
| 31 |
font.math.AxisHeightDeviceTable = None |
| 32 |
assert font.math.AxisHeightDeviceTable == {} |
| 33 |
|
| 34 |
|
| 35 |
font.math.AxisHeightDeviceTable = {10: 3, 11:-1} |
| 36 |
assert font.math.AxisHeightDeviceTable[11] == -1 |
| 37 |
font.math.AxisHeightDeviceTable[11] = None |
| 38 |
assert font.math.AxisHeightDeviceTable[11] == 0 |
| 39 |
|
| 40 |
|
| 41 |
font.math.MathLeadingDeviceTable[9] = -1 |
| 42 |
font.math.MathLeadingDeviceTable[10] = 0 |
| 43 |
font.math.MathLeadingDeviceTable[12] = 2 |
| 44 |
|
| 45 |
|
| 46 |
assert font.math.MathLeadingDeviceTable == {9: -1, 12: 2} |
| 47 |
assert len(font.math.MathLeadingDeviceTable) == 2 |
| 48 |
|
| 49 |
|
| 50 |
assert font.math.MathLeadingDeviceTable[3] == 0 |
| 51 |
assert font.math.MathLeadingDeviceTable[9] == -1 |
| 52 |
assert font.math.MathLeadingDeviceTable[11] == 0 |
| 53 |
assert font.math.MathLeadingDeviceTable[12] == 2 |
| 54 |
assert font.math.MathLeadingDeviceTable[20] == 0 |
| 55 |
|
| 56 |
|
| 57 |
assert font.math.SpaceAfterScriptDeviceTable == {} |
| 58 |
font.math.SpaceAfterScriptDeviceTable = font.math.MathLeadingDeviceTable |
| 59 |
assert font.math.SpaceAfterScriptDeviceTable == {9: -1, 12: 2} |
| 60 |
|
| 61 |
|
| 62 |
assert not font.math.SpaceAfterScriptDeviceTable == {12: 2} |
| 63 |
assert font.math.SpaceAfterScriptDeviceTable != {12: 2} |
| 64 |
|
| 65 |
|
| 66 |
tbl = font.math.MathLeadingDeviceTable |
| 67 |
output = [] |
| 68 |
for px in tbl: |
| 69 |
output.append(px) |
| 70 |
assert tbl[px] != 0 |
| 71 |
|
| 72 |
assert len(output) == len(tbl) |