This topic contains 7 replies, has 2 voices, and was last updated by Bruno 8 years, 10 months ago.
-
AuthorPosts
-
December 12, 2011 at 14:50 #2157
#this works; scales the glyph nicely (components uses glyph coordinate)
g = CurrentGlyph()
g.scale((0.5, 0.5))
g.update()#this doesn’t work as expected; component use their own coordinates
f = CurrentFont()
for g in f:
g.scale((0.5, 0.5))
g.update()December 12, 2011 at 15:04 #2159yeah off course, you scale the component base glyphs to :)
so components will be double scaled, once by their base glyphs and once by the component transformation that get scaled.December 12, 2011 at 20:51 #2166Haha, it drove me insane. Thanks for your enlightenment.
December 13, 2011 at 09:42 #2177I have still not managed to transform the font successfully.
Do I oversee something again? It looks like a bug to me:========================
f = CurrentFont()
for g in f:
if len(g.contours) > 0:
for c in g.contours:
c.scale((0.5, 0.5))
========================
Traceback:
File “2000UPM.py”, line 13, in
File “lib/fontObjects/robofabWrapper.pyc”, line 1432, in scale
File “/Applications/RoboFont.app/Contents/Resources/lib/python2.7/fontTools/misc/transform.py”, line 148, in scale
File “/Applications/RoboFont.app/Contents/Resources/lib/python2.7/fontTools/misc/transform.py”, line 199, in transform
TypeError: can only concatenate tuple (not “int”) to tuple
========================I can make it work via metric transformations. But it’s not as elegant :)
December 13, 2011 at 21:11 #2196that is a really bug :)
a workaround:
from fontTools.misc.transform import Transform f = CurrentFont() t = Transform().scale(.5, .5) ## possible transformations: ## .translate(x, y) ## .rotate(radiansAngle) ## .skew(x, y) ## .inverse() for g in f: g.transform(t, doComponents=False) # or for each contour # for c in g: # c.transform(t)hope this helps,
thanks for reporting and this will be solved in the next update.December 14, 2011 at 03:28 #2203Cool!
Where can I see the RoboFont transform function/glyph class?
I would like to check out if it has any other properties I am unaware off. Is there some documentation I am missing? The fontobjects source is bytecode:
robofabWrapper.pyc
Thanks,
December 14, 2011 at 18:49 #2209December 15, 2011 at 07:11 #2219The object-browser is great! Thanks.
-
AuthorPosts
You must be logged in to reply to this topic.