Optimized build procedure: Now we have better (and smaller) outlines.
This commit is contained in:
parent
ec75ce7f6c
commit
ea83169de0
4 changed files with 36 additions and 36 deletions
30
final.pe
30
final.pe
|
@ -1,30 +0,0 @@
|
|||
Print("Reading Font...")
|
||||
Open($1);
|
||||
SelectAll();
|
||||
ClearHints();
|
||||
ClearInstrs();
|
||||
ClearTable('fpgm');
|
||||
ClearTable('prep');
|
||||
ClearTable('cvt ');
|
||||
ClearTable('maxp');
|
||||
Print("Outline Cleanup...");
|
||||
Simplify(-1, 0);
|
||||
ReplaceWithReference();
|
||||
RemoveOverlap();
|
||||
RoundToInt()
|
||||
RemoveOverlap();
|
||||
UnlinkReference();
|
||||
RemoveOverlap();
|
||||
ReplaceWithReference(4, 1);
|
||||
SelectAll();
|
||||
RemoveOverlap();
|
||||
Print("Simplifying");
|
||||
AddExtrema();
|
||||
Simplify(0, 2);
|
||||
Print("Finalizing");
|
||||
CorrectDirection();
|
||||
CanonicalContours();
|
||||
CanonicalStart();
|
||||
MergeFeature($2);
|
||||
Print("Saving ttf...");
|
||||
Generate($3);
|
17
makefile
17
makefile
|
@ -9,7 +9,8 @@ MAPS = $(subst .ttf,.charmap,$(TARGETS))
|
|||
PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))
|
||||
ABFEAT = $(subst .ttf,.ab.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
|
||||
FEATURE = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
|
||||
PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS))
|
||||
PASS1 = $(subst .ttf,.otf,$(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS)))
|
||||
PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS))
|
||||
|
||||
FILES = $(SUPPORT_FILES) buildglyphs.js
|
||||
|
||||
|
@ -32,11 +33,12 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.
|
|||
cat $^ > $@
|
||||
|
||||
# Pass 1 : Outline cleanup and merge
|
||||
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
|
||||
fontforge -script final.pe $^ $@ $(SUPPRESS_ERRORS)
|
||||
|
||||
# Pass 2 : Simplify and output
|
||||
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass1-%.ttf
|
||||
$(PASS1) : $(OBJDIR)/.pass1-%.otf : $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
|
||||
fontforge -script pass1-cleanup.py $^ $@ $(SUPPRESS_ERRORS)
|
||||
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : $(OBJDIR)/.pass1-%.otf
|
||||
fontforge -script pass2-finalize.py $^ $@
|
||||
# Pass 3 : Simplify and output
|
||||
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf
|
||||
ttfautohint $< $@
|
||||
|
||||
update : $(FILES)
|
||||
|
@ -55,3 +57,6 @@ $(OBJDIR) :
|
|||
|
||||
cleartemps :
|
||||
-rm $(PASS0) $(PASS1)
|
||||
|
||||
test : $(TARGETS)
|
||||
cp $(TARGETS) $(MAPS) testdrive/
|
16
pass1-cleanup.py
Normal file
16
pass1-cleanup.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import fontforge
|
||||
import sys
|
||||
|
||||
source = sys.argv[1]
|
||||
font = fontforge.open(source)
|
||||
font.mergeFeature(sys.argv[2])
|
||||
font.selection.all()
|
||||
font.replaceWithReference(4)
|
||||
font.removeOverlap()
|
||||
font.round()
|
||||
font.removeOverlap()
|
||||
font.unlinkReferences()
|
||||
font.removeOverlap()
|
||||
font.canonicalContours()
|
||||
font.canonicalStart()
|
||||
font.generate(sys.argv[3], flags = ("short-post", "opentype"))
|
9
pass2-finalize.py
Normal file
9
pass2-finalize.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
import fontforge
|
||||
import sys
|
||||
|
||||
source = sys.argv[1]
|
||||
font = fontforge.open(source)
|
||||
font.selection.all()
|
||||
font.replaceWithReference(4)
|
||||
font.simplify(4, ("smoothcurves", "removesingletonpoints", "setstarttoextremum"), 0.2)
|
||||
font.generate(sys.argv[2], flags = ("short-post", "opentype"))
|
Loading…
Add table
Add a link
Reference in a new issue