From: Ben Harris Date: Sat, 3 Mar 2018 20:46:26 +0000 (+0000) Subject: Skeleton code for adjusting dots in plotter fonts. X-Git-Tag: bedstead-002.000~32 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=dd3c9d484574e39d0c7871dcab6c3e7bd5712d1c;p=bedstead-debian.git Skeleton code for adjusting dots in plotter fonts. In light fonts, they end up almost invisible, but I have a plan. --- diff --git a/strokefont.py b/strokefont.py index 49494e8..0721f61 100644 --- a/strokefont.py +++ b/strokefont.py @@ -8,10 +8,14 @@ from sys import argv class Stroker(object): def __init__(self, fontname): self.fontname = fontname + self.dotwidth = max(0, 100 - self.nibwidth) + self.dotheight = max(0, 100 - self.nibheight) def modify_font(self, f): f.strokedfont = False for g in f.glyphs(): + for c in g.layers[1]: + self.adjust_contour(c) g.stroke(*self.nib) g.removeOverlap() g.addExtrema() @@ -30,7 +34,12 @@ class Stroker(object): f.os2_weight = self.ttfweight f.weight = self.weight 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. + class Plotter(Stroker): familyname = "Bedstead Plotter" def __init__(self, penwidth, weight, ttfweight):