mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 13:33:06 -04:00
Minimally-functional code for expanding dots.
It takes a little bit of effort to avoid segfaulting FontForge, and so currently Bedstead Plotter Thin has dots in the middle of its dots. These probably shouldn't stay.
This commit is contained in:
parent
f438f9ad7e
commit
fcbb3c8d90
@ -14,8 +14,9 @@ class Stroker(object):
|
||||
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()
|
||||
@ -37,9 +38,15 @@ class Stroker(object):
|
||||
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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user