示例#1
0
def main(args):
    if not args:
        return
    filename, glyphs = args[0], args[1:]
    if not glyphs:
        glyphs = [
            'e', 'o', 'I', 'slash', 'E', 'zero', 'eight', 'minus', 'equal'
        ]
    from fontemon_blender_addon.fontTools.ttLib import TTFont
    font = TTFont(filename)
    _test(font.getGlyphSet(), font['head'].unitsPerEm, glyphs)
示例#2
0
        sys.exit(0)

    from fontemon_blender_addon.fontTools.ttLib import TTFont
    from reportlab.lib import colors

    path = sys.argv[1]
    glyphName = sys.argv[2]
    if (len(sys.argv) > 3):
        imageFile = sys.argv[3]
    else:
        imageFile = "%s.png" % glyphName

    font = TTFont(
        path
    )  # it would work just as well with fontemon_blender_addon.fontTools.t1Lib.T1Font
    gs = font.getGlyphSet()
    pen = ReportLabPen(gs, Path(fillColor=colors.red, strokeWidth=5))
    g = gs[glyphName]
    g.draw(pen)

    w, h = g.width, 1000
    from reportlab.graphics import renderPM
    from reportlab.graphics.shapes import Group, Drawing, scale

    # Everything is wrapped in a group to allow transformations.
    g = Group(pen.path)
    g.translate(0, 200)
    g.scale(0.3, 0.3)

    d = Drawing(w, h)
    d.add(g)