From dd3c9d484574e39d0c7871dcab6c3e7bd5712d1c Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 3 Mar 2018 20:46:26 +0000 Subject: [PATCH] Skeleton code for adjusting dots in plotter fonts. In light fonts, they end up almost invisible, but I have a plan. --- strokefont.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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): -- 2.30.2