CFF: set FontMatrix based on unitsPerEm automatically, unless manually overridden

This commit is contained in:
justvanrossum 2018-12-05 15:07:20 +01:00
parent de1dbe5f16
commit 874c08dcd2
2 changed files with 4 additions and 1 deletions

View File

@ -478,6 +478,9 @@ class FontBuilder(object):
topDict.Private = private topDict.Private = private
for key, value in fontInfo.items(): for key, value in fontInfo.items():
setattr(topDict, key, value) setattr(topDict, key, value)
if "FontMatrix" not in fontInfo:
scale = 1 / self.font["head"].unitsPerEm
topDict.FontMatrix = [scale, 0, 0, scale, 0, 0]
charStrings = CharStrings(None, topDict.charset, globalSubrs, private, fdSelect, fdArray) charStrings = CharStrings(None, topDict.charset, globalSubrs, private, fdSelect, fdArray)
for glypnName, charString in charStringsDict.items(): for glypnName, charString in charStringsDict.items():

View File

@ -161,7 +161,7 @@
<UnderlineThickness value="50"/> <UnderlineThickness value="50"/>
<PaintType value="0"/> <PaintType value="0"/>
<CharstringType value="2"/> <CharstringType value="2"/>
<FontMatrix value="0.001 0 0 0.001 0 0"/> <FontMatrix value="0.0009765625 0 0 0.0009765625 0 0"/>
<FontBBox value="100 100 500 1000"/> <FontBBox value="100 100 500 1000"/>
<StrokeWidth value="0"/> <StrokeWidth value="0"/>
<!-- charset is dumped separately as the 'GlyphOrder' element --> <!-- charset is dumped separately as the 'GlyphOrder' element -->