Un-hardcode the CFF glyph's left side bearing
This commit is contained in:
parent
b0710b829b
commit
86cea23de3
@ -100,9 +100,10 @@ charString = pen.getCharString()
|
|||||||
charStrings = {".notdef": charString, "A": charString, "a": charString, ".null": charString}
|
charStrings = {".notdef": charString, "A": charString, "a": charString, ".null": charString}
|
||||||
fb.setupCFF(nameStrings['psName'], {"FullName": nameStrings['psName']}, charStrings, {})
|
fb.setupCFF(nameStrings['psName'], {"FullName": nameStrings['psName']}, charStrings, {})
|
||||||
|
|
||||||
|
lsb = {gn: cs.calcBounds(None)[0] for gn, cs in charStrings.items()}
|
||||||
metrics = {}
|
metrics = {}
|
||||||
for gn, advanceWidth in advanceWidths.items():
|
for gn, advanceWidth in advanceWidths.items():
|
||||||
metrics[gn] = (advanceWidth, 100) # XXX lsb from glyph
|
metrics[gn] = (advanceWidth, lsb[gn])
|
||||||
fb.setupHorizontalMetrics(metrics)
|
fb.setupHorizontalMetrics(metrics)
|
||||||
|
|
||||||
fb.setupHorizontalHeader(ascent=824, descent=200)
|
fb.setupHorizontalHeader(ascent=824, descent=200)
|
||||||
|
@ -135,9 +135,11 @@ def test_build_otf(tmpdir):
|
|||||||
charString = pen.getCharString()
|
charString = pen.getCharString()
|
||||||
charStrings = {".notdef": charString, "A": charString, "a": charString, ".null": charString}
|
charStrings = {".notdef": charString, "A": charString, "a": charString, ".null": charString}
|
||||||
fb.setupCFF(nameStrings['psName'], {"FullName": nameStrings['psName']}, charStrings, {})
|
fb.setupCFF(nameStrings['psName'], {"FullName": nameStrings['psName']}, charStrings, {})
|
||||||
|
|
||||||
|
lsb = {gn: cs.calcBounds(None)[0] for gn, cs in charStrings.items()}
|
||||||
metrics = {}
|
metrics = {}
|
||||||
for gn, advanceWidth in advanceWidths.items():
|
for gn, advanceWidth in advanceWidths.items():
|
||||||
metrics[gn] = (advanceWidth, 100) # XXX lsb from glyph
|
metrics[gn] = (advanceWidth, lsb[gn])
|
||||||
fb.setupHorizontalMetrics(metrics)
|
fb.setupHorizontalMetrics(metrics)
|
||||||
|
|
||||||
fb.setupHorizontalHeader(ascent=824, descent=200)
|
fb.setupHorizontalHeader(ascent=824, descent=200)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user