Skip to content

Commit 56c1a32

Browse files
authored
make the otf minimal example work on windows 10
1 parent 506965d commit 56c1a32

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Lib/fontTools/fontBuilder.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ def drawTestGlyph(pen):
7676
from fontTools.fontBuilder import FontBuilder
7777
from fontTools.pens.t2CharStringPen import T2CharStringPen
7878
79+
7980
def drawTestGlyph(pen):
8081
pen.moveTo((100, 100))
8182
pen.lineTo((100, 1000))
8283
pen.curveTo((200, 900), (400, 900), (500, 1000))
8384
pen.lineTo((500, 100))
8485
pen.closePath()
8586
87+
8688
fb = FontBuilder(1024, isTTF=False)
8789
fb.setupGlyphOrder([".notdef", ".null", "A", "a"])
8890
fb.setupCharacterMap({65: "A", 97: "a"})
@@ -91,15 +93,24 @@ def drawTestGlyph(pen):
9193
9294
familyName = "HelloTestFont"
9395
styleName = "TotallyNormal"
94-
nameStrings = dict(familyName=dict(en="HelloTestFont", nl="HalloTestFont"),
95-
styleName=dict(en="TotallyNormal", nl="TotaalNormaal"))
96-
nameStrings['psName'] = familyName + "-" + styleName
96+
nameStrings = dict(
97+
familyName=dict(en=familyName, nl="HalloTestFont"),
98+
styleName=dict(en=styleName, nl="TotaalNormaal"),
99+
uniqueFontIdentifier="fontBuilder: " + familyName + "." + styleName,
100+
fullName=familyName + "-" + styleName,
101+
psName=familyName + "-" + styleName,
102+
)
97103
98104
pen = T2CharStringPen(600, None)
99105
drawTestGlyph(pen)
100106
charString = pen.getCharString()
101-
charStrings = {".notdef": charString, "A": charString, "a": charString, ".null": charString}
102-
fb.setupCFF(nameStrings['psName'], {"FullName": nameStrings['psName']}, charStrings, {})
107+
charStrings = {
108+
".notdef": charString,
109+
"A": charString,
110+
"a": charString,
111+
".null": charString,
112+
}
113+
fb.setupCFF(nameStrings["psName"], {"FullName": nameStrings["psName"]}, charStrings, {})
103114
104115
lsb = {gn: cs.calcBounds(None)[0] for gn, cs in charStrings.items()}
105116
metrics = {}

0 commit comments

Comments
 (0)