diff --git a/buildglyphs.patel b/buildglyphs.patel index af2d154..f78958f 100644 --- a/buildglyphs.patel +++ b/buildglyphs.patel @@ -267,13 +267,18 @@ define [buildFont para recursive] : begin ### Glyph slots and dependency profile generation (used for recursive subfonts) local dependencyProfile {.} local nTemp 0 + local nPending 0 local pickHash : if recursive then : let [h {.}] : begin foreach j [items-of recursive] : set h.(j) j + set nPending recursive.length * h else nothing define [create-glyph name actions] : piecewise (name && actions) : begin + if (pickHash && nPending <= 0) : begin + console.log " Done recursive build for \[if (recursive.length > 3) [recursive.slice 0 3 :.concat {'...'} :.join ','] [recursive.join ',']] in \(font.name.uniqueSubFamily)" + throw {.glyfMap glyphs} if (pickHash && [not pickHash.(name)]) : return nothing set dependencyProfile.(name) {} define glyphObject [new Glyph name] @@ -286,6 +291,7 @@ define [buildFont para recursive] : begin local allAliases : Object.keys glyphs :.filter ([k] -> (glyphs.(k) === glyphs.(d))) dependencyProfile.(name) = [dependencyProfile.(name).concat dependencyProfile.(d) allAliases] # process.stderr.write "\[if recursive 'Recursive ' '']Built Glyph /\(name).\n" + dec nPending return glyphObject true : begin local actions arguments.0 diff --git a/generate.js b/generate.js index 5f1a9f6..3f70a82 100644 --- a/generate.js +++ b/generate.js @@ -8,10 +8,10 @@ var toml = require('toml'); var parametersData = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'parameters.toml'), 'utf-8')); var emptyFont = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'emptyfont.toml'), 'utf-8')); var para = parameters.build(parametersData, argv._); +var fontUniqueName = para.family + ' ' + para.style + ' ' + para.version + ' (' + para.codename + ')' -var ttfFont = buildGlyphs.build.call(emptyFont, para); +console.log(' Start build font' + fontUniqueName); +var font = buildGlyphs.build.call(emptyFont, para); +console.log(' ' + fontUniqueName + " Successfully built."); -if(argv.o) { - console.log(argv.o + " Successfully built. Styles: " + argv._) - fs.writeFileSync(argv.o, JSON.stringify(ttfFont)); -} \ No newline at end of file +if(argv.o) fs.writeFileSync(argv.o, JSON.stringify(font)); \ No newline at end of file diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index 2a7ad60..fad778c 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -320,28 +320,28 @@ if [not recursive] : createCircledGlyphs : [list \\ foreach [j : range 0 26] : a.push {(0x24D0 + j) unicodeGlyphs.(['a'.charCodeAt 0] + j).name FULLWIDTH} * a - -create-glyph 'ordfeminine' : glyph-construction - assign-unicode 0xAA - include [Miniature {'a'} 3.7 0.7].a - include : HBarBottom SB RIGHTSB DESCENDER +if [not recursive] : let [df : Miniature {'a' 'o'} 0.7 0.7] : begin + create-glyph 'ordfeminine' : glyph-construction + assign-unicode 0xAA + include df.a + include : HBarBottom SB RIGHTSB DESCENDER + + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-XH) + apply-transform : Scale 0.7 + apply-transform : Translate MIDDLE CAP + apply-transform : Italify - apply-transform : Upright - apply-transform : Translate (-MIDDLE) (-XH) - apply-transform : Scale 0.7 - apply-transform : Translate MIDDLE CAP - apply-transform : Italify - -create-glyph 'ordmasculine' : glyph-construction - assign-unicode 0xBA - include [Miniature {'o'} 3.7 0.7].o - include : HBarBottom SB RIGHTSB DESCENDER - - apply-transform : Upright - apply-transform : Translate (-MIDDLE) (-XH) - apply-transform : Scale 0.7 - apply-transform : Translate MIDDLE CAP - apply-transform : Italify + create-glyph 'ordmasculine' : glyph-construction + assign-unicode 0xBA + include df.o + include : HBarBottom SB RIGHTSB DESCENDER + + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-XH) + apply-transform : Scale 0.7 + apply-transform : Translate MIDDLE CAP + apply-transform : Italify createSMCPs : list diff --git a/glyphs/common-shapes.patel b/glyphs/common-shapes.patel index ebdc575..d0c35ec 100644 --- a/glyphs/common-shapes.patel +++ b/glyphs/common-shapes.patel @@ -385,7 +385,13 @@ define [Fork glyphs params] : begin local p : Object.create params local shouldBuildList {} foreach glyphid [items-of glyphs] : set shouldBuildList : shouldBuildList.concat {glyphid :: dependencyProfile.(glyphid)} - local forkFont : buildFont.call [TempFont] p shouldBuildList + set shouldBuildList : shouldBuildList.filter : [x] -> [not [not x]] + try : begin + local forkFont : buildFont.call [TempFont] p shouldBuildList + : ex + : begin + if ex.glyfMap : return ex.glyfMap + : else : throw ex return forkFont.glyfMap define [Miniature glyphs fold scale] : begin diff --git a/glyphs/latin-extend-decorated.patel b/glyphs/latin-extend-decorated.patel index ebf2f5f..7482982 100644 --- a/glyphs/latin-extend-decorated.patel +++ b/glyphs/latin-extend-decorated.patel @@ -894,19 +894,18 @@ define [ErTail left w dohook] : glyph-construction create-glyph 'rhotichook' : glyph-construction assign-unicode 0x2DE include : ErTail (-STROKE * CORRECTION_HX) STROKE true -create-glyph 'er' : glyph-construction - assign-unicode 0x25A - include eMarks - local f : Thinner {'schwa'} 0.85 - include f.schwa - include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX) -create-glyph 'revlatinepsiloner' : glyph-construction - assign-unicode 0x25D - include eMarks - local f : Thinner {'revlatinepsilon'} 0.85 - include f.revlatinepsilon - include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX) +if [not recursive] : let [thinfont : Thinner {'schwa' 'revlatinepsilon'} 0.85] : begin + create-glyph 'er' : glyph-construction + assign-unicode 0x25A + include eMarks + include thinfont.schwa + include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX) + create-glyph 'revlatinepsiloner' : glyph-construction + assign-unicode 0x25D + include eMarks + include thinfont.revlatinepsilon + include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX) # Belted define [Belt] : glyph-construction @@ -944,14 +943,11 @@ create-glyph 'ltildeover' : glyph-construction # Double stack if [not recursive]: create-glyph 'ww' : glyph-construction assign-unicode 0x2AC - local p : Object.create para - p.xheight = CAP / 2 - local forked : Fork {'w'} p - include forked.w + include : WShape (CAP / 2) apply-transform : Upright apply-transform : Translate 0 (CAP / 2) apply-transform : Italify - include forked.w + include : WShape (CAP / 2) create-glyph 'bidentalpercussive' : glyph-construction assign-unicode 0x2AD diff --git a/glyphs/symbol-math.patel b/glyphs/symbol-math.patel index 6d4ab58..87eaff1 100644 --- a/glyphs/symbol-math.patel +++ b/glyphs/symbol-math.patel @@ -43,27 +43,26 @@ create-glyph 'product' : glyph-construction include : PiShape parenTop parenBot 0 OPERATORSTROKE turned 'coproduct' 0x2210 'product' MIDDLE parenMid -create-glyph 'infty' : glyph-construction - assign-unicode 0x221E - local s : (RIGHTSB - SB - O * 4) / CAP - include [Miniature {'eight'} 5 s].eight - apply-transform : Upright - apply-transform : Translate (-MIDDLE) (-CAP / 2) - apply-transform : Rotate (Math.PI / 2) - apply-transform : Scale s - apply-transform : Translate MIDDLE parenMid - apply-transform : Italify - -create-glyph 'propto' : glyph-construction - assign-unicode 0x221D - local s : (RIGHTSB - SB - O * 4) / CAP - include [Miniature {'rotetedpropto'} 5 s].rotetedpropto - apply-transform : Upright - apply-transform : Translate (-MIDDLE) (-CAP / 2) - apply-transform : Rotate (Math.PI / 2) - apply-transform : Scale s - apply-transform : Translate MIDDLE parenMid - apply-transform : Italify +if [not recursive] : let [s : (RIGHTSB - SB - O * 4) / CAP] : let [df : Miniature {'eight' 'rotetedpropto'} 5 s] : begin + create-glyph 'infty' : glyph-construction + assign-unicode 0x221E + include df.eight + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-CAP / 2) + apply-transform : Rotate (Math.PI / 2) + apply-transform : Scale s + apply-transform : Translate MIDDLE parenMid + apply-transform : Italify + + create-glyph 'propto' : glyph-construction + assign-unicode 0x221D + include df.rotetedpropto + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-CAP / 2) + apply-transform : Rotate (Math.PI / 2) + apply-transform : Scale s + apply-transform : Translate MIDDLE parenMid + apply-transform : Italify create-glyph 'partial' : glyph-construction assign-unicode 0x2202 diff --git a/makefile b/makefile index 1080813..53680dd 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,5 @@ +default: fonts + OBJDIR = build include makesupport.mk PARAM_DEFAULT = FAST='$(FAST)' SUFFIX='' VARIANTNAME='$(VARIANTNAME)' STYLE_COMMON='$(STYLE_COMMON)' STYLE_UPRIGHT='$(STYLE_UPRIGHT)' STYLE_ITALIC='$(STYLE_ITALIC)' VERSION='$(VERSION)' diff --git a/makesupport.mk b/makesupport.mk index 732e3dd..1894e74 100644 --- a/makesupport.mk +++ b/makesupport.mk @@ -3,7 +3,7 @@ GLYPH_SEGMENTS = glyphs/common-shapes.patel glyphs/overmarks.patel glyphs/latin- SCRIPTS = $(SUPPORT_FILES) buildglyphs.js buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS) - patel-c --optimize --mangle --strict $< -o $@ + patel-c --optimize --strict $< -o $@ $(SUPPORT_FILES) : patel-c --strict $< -o $@ diff --git a/onegroup.mk b/onegroup.mk index 434ce8b..580794b 100644 --- a/onegroup.mk +++ b/onegroup.mk @@ -1,3 +1,5 @@ +default: fonts + TARGETUPM = 1000 OBJDIR = build include makesupport.mk @@ -63,11 +65,11 @@ $(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf $(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-smartround.js $(OBJDIR)/.pass1-%.ttf $(NODE) $^ $@ --upm $(TARGETUPM) $(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-features.py $(OBJDIR)/.pass2-%.ttf $(OBJDIR)/.pass0-%.fea - fontforge -quiet -script $^ $@ $(TARGETUPM) + fontforge -quiet -script $^ $@ $(TARGETUPM) $(SUPPRESS_ERRORS) $(PASS4) : $(OBJDIR)/.pass4-%.ttf : pass4-finalize.js $(OBJDIR)/.pass3-%.ttf @$(NODE) $^ $@.a.ttf - @ttx -q -o $@.a.ttx $@.a.ttf - @ttx -q -o $@ $@.a.ttx + @ttx -q -o $@.a.ttx $@.a.ttf $(SUPPRESS_ERRORS) + @ttx -q -o $@ $@.a.ttx $(SUPPRESS_ERRORS) @rm $@.a.ttf $@.a.ttx $(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass4-%.ttf ttfautohint $< $@ diff --git a/pass1-cleanup.py b/pass1-cleanup.py index 6ee1378..eeeeb54 100644 --- a/pass1-cleanup.py +++ b/pass1-cleanup.py @@ -8,7 +8,7 @@ font = fontforge.open(source) # Replace accented characters into references if len(sys.argv) <= 3: - print "Reference finding: ", font.fontname + print " Reference finding: ", font.fontname font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF) font.replaceWithReference(2) font.selection.all() @@ -16,7 +16,7 @@ if len(sys.argv) <= 3: font.replaceWithReference(2) # Remove overlapped area -print "Overlap Removal: ", font.fontname +print " Overlap Removal: ", font.fontname font.selection.all() font.removeOverlap() font.round() @@ -33,12 +33,12 @@ if len(sys.argv) <= 3: font.unlinkReferences() # Outline simplify -print "Simplify: ", font.fontname +print " Simplify: ", font.fontname font.layers["Fore"].is_quadratic = False font.selection.all() font.simplify(font.em / 2000.0, ("smoothcurves", "choosehv"), 0.1) -print "Finalize: ", font.fontname +print " Finalize: ", font.fontname oldem = font.em font.em = 1000 font.layers["Fore"].is_quadratic = True