f.strokedfont = False
for g in f.glyphs():
- for c in g.layers[1]:
- self.adjust_contour(c)
+ for i, c in enumerate(list(g.layers[1])):
+ newc = self.adjust_contour(c)
+ if newc != None: g.layers[1] += newc
g.stroke(*self.nib)
g.removeOverlap()
g.addExtrema()
return f
def adjust_contour(self, c):
# This function just expands dots.
- if len(c) != 1: return
- if self.dotwidth == 0 and self.dotheight == 0: return
- # insert actual modifying code here.
+ if len(c) != 1: return None
+ if self.dotwidth == 0 and self.dotheight == 0: return None
+ newc = fontforge.contour()
+ newc.moveTo(c[0].x + self.dotwidth/2, c[0].y)
+ newc.lineTo(c[0].x, c[0].y + self.dotheight/2)
+ newc.lineTo(c[0].x - self.dotwidth/2, c[0].y)
+ newc.lineTo(c[0].x, c[0].y - self.dotheight/2)
+ newc.closed = True
+ return newc
class Plotter(Stroker):
familyname = "Bedstead Plotter"