chiark / gitweb /
strokefont: Set StdHW and StdVW appropriately to pen.
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 12 Aug 2017 08:41:01 +0000 (09:41 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 12 Aug 2017 08:41:01 +0000 (09:41 +0100)
strokefont.py

index e6595104c1587a740a60fff406e92d9de54e0de3..d0a39d485205f579a2b7dba5f595643aef61332b 100644 (file)
@@ -15,15 +15,17 @@ class Stroker(object):
             g.stroke(*self.nib)
             g.removeOverlap()
             g.addExtrema()
-            g.transform(translate(0, self.vshift))
+            g.transform(translate(0, self.nibheight/2.0))
 
         f.fontname = self.fontname
+        f.private['StdHW'] = self.nibheight
+        f.private['StdVW'] = self.nibwidth
         return f
 
 class Plotter(Stroker):
     def __init__(self, penwidth, weight):
         self.nib = ['circular', penwidth, 'round', 'round']
-        self.vshift = penwidth / 2.0
+        self.nibwidth = self.nibheight = penwidth
         super(Plotter, self).__init__("BedsteadPlotter-" + weight)
 
 class Chiseltip(Stroker):
@@ -35,7 +37,8 @@ class Chiseltip(Stroker):
         chisel.lineTo(-28, -45)
         chisel.closed = True
         self.nib = ['polygonal', chisel]
-        self.vshift = 45
+        self.nibwidth = 100
+        self.nibheight = 90
         super(Chiseltip, self).__init__(fontname)
 
 modes = {