fonttools/Scripts/RoboFabIntro/intro_GlyphObject.py
Erik van Blokland 617945dcf1 The scripts folder for FontLab as they shipped with Fab 1.1.1.
git-svn-id: http://svn.robofab.com/trunk@22 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-16 08:14:00 +00:00

34 lines
911 B
Python

#FLM: RoboFab Intro, The Glyph Object
#
#
# demo of the RoboFab glyph object
#
#
import robofab
from robofab.world import CurrentFont, CurrentGlyph
from robofab.interface.all.dialogs import Message
# (make sure you have a font opened in FontLab)
# this code starts out the same as intro_FontObject
f = CurrentFont()
if f == None:
Message("You should open a font first, there's nothing to look at now!")
else:
for g in f:
print "glyphname:", g.name, ", glyph width:", g.width
# so now g is a RoboFab Glyph object
print "this glyph has %d contours" % len(g.contours)
print "this glyph has %d components" % len(g.components)
print "this glyph has %d anchors" % len(g.anchors)
print
# easy huh?
# There are many more attributes and methods.
# Most of these can be used to edit the font data.
# Which makes them not suited for a simple intro as this
# because we don't want to mess up your font.