mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 21:43:06 -04:00
strokefont: Better font name handling
This gets the PostScript names right. TTF names are more difficult.
This commit is contained in:
parent
f7290084a3
commit
b83df76033
@ -17,18 +17,31 @@ class Stroker(object):
|
||||
g.addExtrema()
|
||||
g.transform(translate(0, self.nibheight/2.0))
|
||||
|
||||
f.familyname = self.familyname
|
||||
f.fontname = self.fontname
|
||||
f.fullname = self.fullname
|
||||
f.private['StdHW'] = self.nibheight
|
||||
f.private['StdVW'] = self.nibwidth
|
||||
f.os2_weight = self.ttfweight
|
||||
f.weight = self.weight
|
||||
return f
|
||||
|
||||
class Plotter(Stroker):
|
||||
def __init__(self, penwidth, weight):
|
||||
familyname = "Bedstead Plotter"
|
||||
def __init__(self, penwidth, weight, ttfweight):
|
||||
self.nib = ['circular', penwidth, 'round', 'round']
|
||||
self.nibwidth = self.nibheight = penwidth
|
||||
self.fontname = "BedsteadPlotter-" + weight
|
||||
self.fullname = "%s %s" % (self.familyname, weight)
|
||||
self.ttfweight = ttfweight
|
||||
self.weight = weight
|
||||
super(Plotter, self).__init__("BedsteadPlotter-" + weight)
|
||||
|
||||
class Chiseltip(Stroker):
|
||||
familyname = "Bedstead Chiseltip"
|
||||
fullname = "Bedstead Chiseltip"
|
||||
weight = "Medium"
|
||||
ttfweight = 500
|
||||
def __init__(self, fontname):
|
||||
chisel = fontforge.contour()
|
||||
chisel.moveTo(-50, 0)
|
||||
@ -42,10 +55,10 @@ class Chiseltip(Stroker):
|
||||
super(Chiseltip, self).__init__(fontname)
|
||||
|
||||
modes = {
|
||||
'plotter-thin': Plotter(10, "Thin"),
|
||||
'plotter-light': Plotter(50, "Light"),
|
||||
'plotter-medium': Plotter(100, "Medium"),
|
||||
'plotter-bold': Plotter(150, "Bold"),
|
||||
'plotter-thin': Plotter(10, "Thin", 100),
|
||||
'plotter-light': Plotter(50, "Light", 300),
|
||||
'plotter-medium': Plotter(100, "Medium", 500),
|
||||
'plotter-bold': Plotter(150, "Bold", 700),
|
||||
'chiseltip': Chiseltip("BedsteadChiseltip"),
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user