のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

ufo point pen

def read(ufo_path):
    ufo = UFOReader(ufo_path)
    lib = ufo.readLib()
    glyph_order = lib['public.glyphOrder']
    glyph_set = ufo.getGlyphSet()
    for glyph_name in glyph_order:
        glifBytes = glyph_set.getGLIF(glyph_name)
        g = glyph_set[glyph_name]
        pen = RecordingPointPen()
        g.drawPoints(pen)
        print(g.__dict__)
        # print(pointPen.value)
        pprint(pen.value)
def read(ufo_path):
    ufo = UFOReader(ufo_path)
    lib = ufo.readLib()
    glyph_order = lib['public.glyphOrder']
    glyph_set = ufo.getGlyphSet()
    for glyph_name in glyph_order:
        glifBytes = glyph_set.getGLIF(glyph_name)
        # glyph = Glyph(glyph_name, glyph_set)
        # rg = glyph_set.readGlyph(glyph_name, glyph)
        # glyph_set.readGlyph(glyph_name, glyph, glyph)
        # glyph_set.readGlyphFromString()

        g = glyph_set[glyph_name]
        # pointPen = fontTools.pens.pointPen.SegmentToPointPen()
        # pointPen = fontTools.pens.basePen.BasePen(g)
        # pointPen= fontTools.pens.pointPen.AbstractPointPen()
        # pointPen = fontTools.pens.pointPen.BasePointToSegmentPen()
        # pointPen = fontTools.pens.pointPen.PointToSegmentPen()
        pointPen = RecordingPointPen()
        # pointPen = GLIFPointPen()
        g.drawPoints(pointPen)
        print(g.__dict__)
        print(pointPen.__dict__)