From: Ben Harris Date: Sat, 12 Aug 2017 09:05:52 +0000 (+0100) Subject: strokefont: Better font name handling X-Git-Tag: bedstead-002.000~66 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=b83df760331b6f77c0826c8a0edc020696bf5f9f;p=bedstead.git strokefont: Better font name handling This gets the PostScript names right. TTF names are more difficult. --- diff --git a/strokefont.py b/strokefont.py index d0a39d4..75f315a 100644 --- a/strokefont.py +++ b/strokefont.py @@ -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"), }