Glyph is referenced by GlyphSet.

git-svn-id: http://svn.robofab.com/branches/ufo3k@309 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
Tal Leming 2011-09-28 13:16:25 +00:00
parent 7029ca8b6e
commit 48d65fdfc8

View File

@ -45,6 +45,36 @@ else:
LAYERINFO_FILENAME = "layercontents.plist" LAYERINFO_FILENAME = "layercontents.plist"
# ------------
# Simple Glyph
# ------------
class Glyph(object):
"""
Minimal glyph object. It has no glyph attributes until either
the draw() or the drawPoint() method has been called.
"""
def __init__(self, glyphName, glyphSet):
self.glyphName = glyphName
self.glyphSet = glyphSet
def draw(self, pen):
"""
Draw this glyph onto a *FontTools* Pen.
"""
from robofab.pens.adapterPens import PointToSegmentPen
pointPen = PointToSegmentPen(pen)
self.drawPoints(pointPen)
def drawPoints(self, pointPen):
"""
Draw this glyph onto a PointPen.
"""
self.glyphSet.readGlyph(self.glyphName, self, pointPen)
# --------- # ---------
# Glyph Set # Glyph Set
# --------- # ---------
@ -335,36 +365,6 @@ class GlyphSet(object):
return contents return contents
# ------------
# Simple Glyph
# ------------
class Glyph(object):
"""
Minimal glyph object. It has no glyph attributes until either
the draw() or the drawPoint() method has been called.
"""
def __init__(self, glyphName, glyphSet):
self.glyphName = glyphName
self.glyphSet = glyphSet
def draw(self, pen):
"""
Draw this glyph onto a *FontTools* Pen.
"""
from robofab.pens.adapterPens import PointToSegmentPen
pointPen = PointToSegmentPen(pen)
self.drawPoints(pointPen)
def drawPoints(self, pointPen):
"""
Draw this glyph onto a PointPen.
"""
self.glyphSet.readGlyph(self.glyphName, self, pointPen)
# ----------------------- # -----------------------
# Glyph Name to File Name # Glyph Name to File Name
# ----------------------- # -----------------------
@ -505,6 +505,10 @@ def writeGlyphToString(glyphName, glyphObject=None, drawPointsFunc=None, writer=
else: else:
return None return None
# -----------------------
# layerinfo.plist Support
# -----------------------
# ----------------- # -----------------
# GLIF Tree Support # GLIF Tree Support
# ----------------- # -----------------