"hint-first" build workflow

This commit is contained in:
be5invis 2016-04-19 00:37:22 +08:00
parent a746532692
commit 9f84c62c58
3 changed files with 14 additions and 9 deletions

View File

@ -102,20 +102,20 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.fdt
$(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.fdt
$(PASS)
HINT = ttfautohint --increase-x-height=0
# Pass 1 : Outline cleanup and merge features
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.svg $(OBJDIR)/.pass0-%.fea
@fontforge -quiet -script $^ $@ $(if $(findstring italic,$@),10,$(if $(findstring oblique,$@),10,0)) $(FAST) $(SUPPRESS_ERRORS)
@fontforge -quiet -script $^ $@.a.ttf $(if $(findstring italic,$@),10,$(if $(findstring oblique,$@),10,0)) $(FAST) $(SUPPRESS_ERRORS)
@$(HINT) $@.a.ttf $@
@-rm $@.a.ttf
# Pass 2 : add metadata
# IDKY, but converting into TTX and convert back dramatically reduces the file size
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(OBJDIR)/.pass0-%.fdt
$(TARGETS) : $(OBJDIR)/%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(OBJDIR)/.pass0-%.fdt
@otfccdump $(word 2,$^) | $(NODE) $< $(word 3,$^) | otfccbuild -o $@ --ignore-glyph-order --keep-average-char-width --dummy-dsig --short-post
HINT = ttfautohint --increase-x-height=0
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf
@$(HINT) $< $@
$(DISTTARGETS) : $(DISTDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf
@$(HINT) $< $@
$(DISTTARGETS) : $(DISTDIR)/%.ttf : $(OBJDIR)/%.ttf
@cp $< $@
# releaseing
ARCHIVEDIR = release-archives

View File

@ -52,4 +52,4 @@ font.removeOverlap()
font.canonicalContours()
font.canonicalStart()
font.generate(sys.argv[3], flags = ("short-post", "opentype"))
font.generate(sys.argv[3], flags = ("opentype"))

View File

@ -10,9 +10,14 @@ process.stdin.on('end', function () {
var ttf = JSON.parse(fs.readFileSync(argv._[0], 'utf-8'));
if(glyfsource[0] == '\uFEFF') glyfsource = glyfsource.slice(1);
var glyfs = JSON.parse(glyfsource);
ttf.post.format = 3.0
ttf.post.format = 3.0;
ttf.cmap = glyfs.cmap;
ttf.glyf = glyfs.glyf;
ttf.prep = glyfs.prep;
ttf.fpgm = glyfs.fpgm;
ttf.cvt_ = glyfs.cvt_;
ttf.maxp = glyfs.maxp;
ttf.gasp = glyfs.gasp;
ttf.GDEF = glyfs.GDEF;
ttf.GSUB = glyfs.GSUB;
ttf.GPOS = glyfs.GPOS;