m = 100 c = 50 for ufo in ufos: newPage(1000, 1000) fontobject = Font(os.path.join(master_dir, ufo)) pen = CocoaPen(fontobject) x = m fontSize(12) font("Menlo") text(ufo, (x, m)) translate(m, height() - m) save() for glyphName in fontobject.glyphOrder: if glyphName in fontobject: glyph = fontobject[glyphName] pen.path = NSBezierPath.bezierPath() glyph.draw(pen) save() scale(0.015) drawPath(pen.path) restore() translate(c) x += c if x >= width() - m: restore() x = m translate(0, -c) save() restore() #if glyph.unicode: # char = unichr(glyph.unicode)
fontpath1 = "master_ttf_interpolatable/Roboto-Bold.ttf" fontpath2 = "instances/RobotoB-VF-instanceBold.ttf" ttfont1 = TTFont(fontpath1) ttfont2 = TTFont(fontpath2) pen1 = CocoaPen(ttfont1.getGlyphSet()) pen2 = CocoaPen(ttfont2.getGlyphSet()) color1 = (1, 0, 0, 0.5) color2 = (0, 0, 1, 0.5) unequalmetrics = [] for char in charset: pen1.path = NSBezierPath.bezierPath() pen2.path = NSBezierPath.bezierPath() glyph1 = pen1.glyphSet[char] glyph2 = pen2.glyphSet[char] glyph1.draw(pen1) glyph2.draw(pen2) newPage(2500, 2500) fill(None) strokeWidth(2) offsetX = 500 offsetY = 500 translate(offsetX, offsetY) # baseline stroke(0, 0, 0, 0.25)
"old-duovars/XOPQminYOPQmin.ufo", "../src/1-drawings/RobotoDelta-XOPQmax-YOPQmax.ufo", "old-duovars/XOPQmaxYOPQmax.ufo", "../src/1-drawings/RobotoDelta-XTRAmin.ufo", "old-duovars/XTRAmin.ufo", ] size(2100, 625) translate(25, 25) scale(0.05) for path in reversed(fonts): f = Font(path) pen = CocoaPen(f) save() for char in string.uppercase: pen.path = NSBezierPath.alloc().init() glyph = f[char] glyph.draw(pen) drawPath(pen.path) translate(glyph.width) restore() translate(0, 2000) saveImage(["drawFonts.pdf"])