Reduced buildfont recursions.
This commit is contained in:
parent
9f993b0e97
commit
ab627c1da5
|
@ -267,13 +267,18 @@ define [buildFont para recursive] : begin
|
||||||
### Glyph slots and dependency profile generation (used for recursive subfonts)
|
### Glyph slots and dependency profile generation (used for recursive subfonts)
|
||||||
local dependencyProfile {.}
|
local dependencyProfile {.}
|
||||||
local nTemp 0
|
local nTemp 0
|
||||||
|
local nPending 0
|
||||||
local pickHash : if recursive
|
local pickHash : if recursive
|
||||||
then : let [h {.}] : begin
|
then : let [h {.}] : begin
|
||||||
foreach j [items-of recursive] : set h.(j) j
|
foreach j [items-of recursive] : set h.(j) j
|
||||||
|
set nPending recursive.length
|
||||||
* h
|
* h
|
||||||
else nothing
|
else nothing
|
||||||
define [create-glyph name actions] : piecewise
|
define [create-glyph name actions] : piecewise
|
||||||
(name && actions) : begin
|
(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
|
if (pickHash && [not pickHash.(name)]) : return nothing
|
||||||
set dependencyProfile.(name) {}
|
set dependencyProfile.(name) {}
|
||||||
define glyphObject [new Glyph 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)))
|
local allAliases : Object.keys glyphs :.filter ([k] -> (glyphs.(k) === glyphs.(d)))
|
||||||
dependencyProfile.(name) = [dependencyProfile.(name).concat dependencyProfile.(d) allAliases]
|
dependencyProfile.(name) = [dependencyProfile.(name).concat dependencyProfile.(d) allAliases]
|
||||||
# process.stderr.write "\[if recursive 'Recursive ' '']Built Glyph /\(name).\n"
|
# process.stderr.write "\[if recursive 'Recursive ' '']Built Glyph /\(name).\n"
|
||||||
|
dec nPending
|
||||||
return glyphObject
|
return glyphObject
|
||||||
true : begin
|
true : begin
|
||||||
local actions arguments.0
|
local actions arguments.0
|
||||||
|
|
10
generate.js
10
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 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 emptyFont = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'emptyfont.toml'), 'utf-8'));
|
||||||
var para = parameters.build(parametersData, argv._);
|
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) {
|
if(argv.o) fs.writeFileSync(argv.o, JSON.stringify(font));
|
||||||
console.log(argv.o + " Successfully built. Styles: " + argv._)
|
|
||||||
fs.writeFileSync(argv.o, JSON.stringify(ttfFont));
|
|
||||||
}
|
|
|
@ -320,10 +320,10 @@ if [not recursive] : createCircledGlyphs : [list \\
|
||||||
foreach [j : range 0 26] : a.push {(0x24D0 + j) unicodeGlyphs.(['a'.charCodeAt 0] + j).name FULLWIDTH}
|
foreach [j : range 0 26] : a.push {(0x24D0 + j) unicodeGlyphs.(['a'.charCodeAt 0] + j).name FULLWIDTH}
|
||||||
* a
|
* a
|
||||||
|
|
||||||
|
if [not recursive] : let [df : Miniature {'a' 'o'} 0.7 0.7] : begin
|
||||||
create-glyph 'ordfeminine' : glyph-construction
|
create-glyph 'ordfeminine' : glyph-construction
|
||||||
assign-unicode 0xAA
|
assign-unicode 0xAA
|
||||||
include [Miniature {'a'} 3.7 0.7].a
|
include df.a
|
||||||
include : HBarBottom SB RIGHTSB DESCENDER
|
include : HBarBottom SB RIGHTSB DESCENDER
|
||||||
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
|
@ -334,7 +334,7 @@ create-glyph 'ordfeminine' : glyph-construction
|
||||||
|
|
||||||
create-glyph 'ordmasculine' : glyph-construction
|
create-glyph 'ordmasculine' : glyph-construction
|
||||||
assign-unicode 0xBA
|
assign-unicode 0xBA
|
||||||
include [Miniature {'o'} 3.7 0.7].o
|
include df.o
|
||||||
include : HBarBottom SB RIGHTSB DESCENDER
|
include : HBarBottom SB RIGHTSB DESCENDER
|
||||||
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
|
|
|
@ -385,7 +385,13 @@ define [Fork glyphs params] : begin
|
||||||
local p : Object.create params
|
local p : Object.create params
|
||||||
local shouldBuildList {}
|
local shouldBuildList {}
|
||||||
foreach glyphid [items-of glyphs] : set shouldBuildList : shouldBuildList.concat {glyphid :: dependencyProfile.(glyphid)}
|
foreach glyphid [items-of glyphs] : set shouldBuildList : shouldBuildList.concat {glyphid :: dependencyProfile.(glyphid)}
|
||||||
|
set shouldBuildList : shouldBuildList.filter : [x] -> [not [not x]]
|
||||||
|
try : begin
|
||||||
local forkFont : buildFont.call [TempFont] p shouldBuildList
|
local forkFont : buildFont.call [TempFont] p shouldBuildList
|
||||||
|
: ex
|
||||||
|
: begin
|
||||||
|
if ex.glyfMap : return ex.glyfMap
|
||||||
|
: else : throw ex
|
||||||
return forkFont.glyfMap
|
return forkFont.glyfMap
|
||||||
|
|
||||||
define [Miniature glyphs fold scale] : begin
|
define [Miniature glyphs fold scale] : begin
|
||||||
|
|
|
@ -894,18 +894,17 @@ define [ErTail left w dohook] : glyph-construction
|
||||||
create-glyph 'rhotichook' : glyph-construction
|
create-glyph 'rhotichook' : glyph-construction
|
||||||
assign-unicode 0x2DE
|
assign-unicode 0x2DE
|
||||||
include : ErTail (-STROKE * CORRECTION_HX) STROKE true
|
include : ErTail (-STROKE * CORRECTION_HX) STROKE true
|
||||||
|
|
||||||
|
if [not recursive] : let [thinfont : Thinner {'schwa' 'revlatinepsilon'} 0.85] : begin
|
||||||
create-glyph 'er' : glyph-construction
|
create-glyph 'er' : glyph-construction
|
||||||
assign-unicode 0x25A
|
assign-unicode 0x25A
|
||||||
include eMarks
|
include eMarks
|
||||||
local f : Thinner {'schwa'} 0.85
|
include thinfont.schwa
|
||||||
include f.schwa
|
|
||||||
include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX)
|
include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX)
|
||||||
|
|
||||||
create-glyph 'revlatinepsiloner' : glyph-construction
|
create-glyph 'revlatinepsiloner' : glyph-construction
|
||||||
assign-unicode 0x25D
|
assign-unicode 0x25D
|
||||||
include eMarks
|
include eMarks
|
||||||
local f : Thinner {'revlatinepsilon'} 0.85
|
include thinfont.revlatinepsilon
|
||||||
include f.revlatinepsilon
|
|
||||||
include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX)
|
include : ErTail (WIDTH * 0.85 - SB - markFine * CORRECTION_HX)
|
||||||
|
|
||||||
# Belted
|
# Belted
|
||||||
|
@ -944,14 +943,11 @@ create-glyph 'ltildeover' : glyph-construction
|
||||||
# Double stack
|
# Double stack
|
||||||
if [not recursive]: create-glyph 'ww' : glyph-construction
|
if [not recursive]: create-glyph 'ww' : glyph-construction
|
||||||
assign-unicode 0x2AC
|
assign-unicode 0x2AC
|
||||||
local p : Object.create para
|
include : WShape (CAP / 2)
|
||||||
p.xheight = CAP / 2
|
|
||||||
local forked : Fork {'w'} p
|
|
||||||
include forked.w
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
apply-transform : Translate 0 (CAP / 2)
|
apply-transform : Translate 0 (CAP / 2)
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
include forked.w
|
include : WShape (CAP / 2)
|
||||||
|
|
||||||
create-glyph 'bidentalpercussive' : glyph-construction
|
create-glyph 'bidentalpercussive' : glyph-construction
|
||||||
assign-unicode 0x2AD
|
assign-unicode 0x2AD
|
||||||
|
|
|
@ -43,10 +43,10 @@ create-glyph 'product' : glyph-construction
|
||||||
include : PiShape parenTop parenBot 0 OPERATORSTROKE
|
include : PiShape parenTop parenBot 0 OPERATORSTROKE
|
||||||
|
|
||||||
turned 'coproduct' 0x2210 'product' MIDDLE parenMid
|
turned 'coproduct' 0x2210 'product' MIDDLE parenMid
|
||||||
|
if [not recursive] : let [s : (RIGHTSB - SB - O * 4) / CAP] : let [df : Miniature {'eight' 'rotetedpropto'} 5 s] : begin
|
||||||
create-glyph 'infty' : glyph-construction
|
create-glyph 'infty' : glyph-construction
|
||||||
assign-unicode 0x221E
|
assign-unicode 0x221E
|
||||||
local s : (RIGHTSB - SB - O * 4) / CAP
|
include df.eight
|
||||||
include [Miniature {'eight'} 5 s].eight
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
apply-transform : Translate (-MIDDLE) (-CAP / 2)
|
apply-transform : Translate (-MIDDLE) (-CAP / 2)
|
||||||
apply-transform : Rotate (Math.PI / 2)
|
apply-transform : Rotate (Math.PI / 2)
|
||||||
|
@ -56,8 +56,7 @@ create-glyph 'infty' : glyph-construction
|
||||||
|
|
||||||
create-glyph 'propto' : glyph-construction
|
create-glyph 'propto' : glyph-construction
|
||||||
assign-unicode 0x221D
|
assign-unicode 0x221D
|
||||||
local s : (RIGHTSB - SB - O * 4) / CAP
|
include df.rotetedpropto
|
||||||
include [Miniature {'rotetedpropto'} 5 s].rotetedpropto
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
apply-transform : Translate (-MIDDLE) (-CAP / 2)
|
apply-transform : Translate (-MIDDLE) (-CAP / 2)
|
||||||
apply-transform : Rotate (Math.PI / 2)
|
apply-transform : Rotate (Math.PI / 2)
|
||||||
|
|
2
makefile
2
makefile
|
@ -1,3 +1,5 @@
|
||||||
|
default: fonts
|
||||||
|
|
||||||
OBJDIR = build
|
OBJDIR = build
|
||||||
include makesupport.mk
|
include makesupport.mk
|
||||||
PARAM_DEFAULT = FAST='$(FAST)' SUFFIX='' VARIANTNAME='$(VARIANTNAME)' STYLE_COMMON='$(STYLE_COMMON)' STYLE_UPRIGHT='$(STYLE_UPRIGHT)' STYLE_ITALIC='$(STYLE_ITALIC)' VERSION='$(VERSION)'
|
PARAM_DEFAULT = FAST='$(FAST)' SUFFIX='' VARIANTNAME='$(VARIANTNAME)' STYLE_COMMON='$(STYLE_COMMON)' STYLE_UPRIGHT='$(STYLE_UPRIGHT)' STYLE_ITALIC='$(STYLE_ITALIC)' VERSION='$(VERSION)'
|
||||||
|
|
|
@ -3,7 +3,7 @@ GLYPH_SEGMENTS = glyphs/common-shapes.patel glyphs/overmarks.patel glyphs/latin-
|
||||||
SCRIPTS = $(SUPPORT_FILES) buildglyphs.js
|
SCRIPTS = $(SUPPORT_FILES) buildglyphs.js
|
||||||
|
|
||||||
buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS)
|
buildglyphs.js : buildglyphs.patel $(GLYPH_SEGMENTS)
|
||||||
patel-c --optimize --mangle --strict $< -o $@
|
patel-c --optimize --strict $< -o $@
|
||||||
|
|
||||||
$(SUPPORT_FILES) :
|
$(SUPPORT_FILES) :
|
||||||
patel-c --strict $< -o $@
|
patel-c --strict $< -o $@
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
default: fonts
|
||||||
|
|
||||||
TARGETUPM = 1000
|
TARGETUPM = 1000
|
||||||
OBJDIR = build
|
OBJDIR = build
|
||||||
include makesupport.mk
|
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
|
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-smartround.js $(OBJDIR)/.pass1-%.ttf
|
||||||
$(NODE) $^ $@ --upm $(TARGETUPM)
|
$(NODE) $^ $@ --upm $(TARGETUPM)
|
||||||
$(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-features.py $(OBJDIR)/.pass2-%.ttf $(OBJDIR)/.pass0-%.fea
|
$(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
|
$(PASS4) : $(OBJDIR)/.pass4-%.ttf : pass4-finalize.js $(OBJDIR)/.pass3-%.ttf
|
||||||
@$(NODE) $^ $@.a.ttf
|
@$(NODE) $^ $@.a.ttf
|
||||||
@ttx -q -o $@.a.ttx $@.a.ttf
|
@ttx -q -o $@.a.ttx $@.a.ttf $(SUPPRESS_ERRORS)
|
||||||
@ttx -q -o $@ $@.a.ttx
|
@ttx -q -o $@ $@.a.ttx $(SUPPRESS_ERRORS)
|
||||||
@rm $@.a.ttf $@.a.ttx
|
@rm $@.a.ttf $@.a.ttx
|
||||||
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass4-%.ttf
|
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass4-%.ttf
|
||||||
ttfautohint $< $@
|
ttfautohint $< $@
|
||||||
|
|
Loading…
Reference in New Issue
Block a user