S
swiftset
I'm try to convert a glyph into a format I can easily numerically
manipulate. So far I've figured out how to use ttfquery to get a list
that represents the outline of a contour in a glyph:
from ttfquery import describe, glyphquery, glyph
f = describe.openFont("/usr/share/fonts/truetype/freefont/
FreeSans.ttf")
n = glyphquery.glyphName(f, 'D')
g = glyph.Glyph(n)
c = g.calculateContours(f)
o = glyph.decomposeOutline(c[1])
o looks like:
[array([182, 82],'s'),
(354, 82),
(420.22222222222229, 90.000000000000014),
(474.88888888888891, 114.0), ...,
array([182, 82],'s'),
array([182, 82],'s')]
Is this a polyline?
Thanks,
Alex
manipulate. So far I've figured out how to use ttfquery to get a list
that represents the outline of a contour in a glyph:
from ttfquery import describe, glyphquery, glyph
f = describe.openFont("/usr/share/fonts/truetype/freefont/
FreeSans.ttf")
n = glyphquery.glyphName(f, 'D')
g = glyph.Glyph(n)
c = g.calculateContours(f)
o = glyph.decomposeOutline(c[1])
o looks like:
[array([182, 82],'s'),
(354, 82),
(420.22222222222229, 90.000000000000014),
(474.88888888888891, 114.0), ...,
array([182, 82],'s'),
array([182, 82],'s')]
Is this a polyline?
Thanks,
Alex