make release would now bundle web fonts (WOFF and WOFF2)

This commit is contained in:
be5invis 2017-05-19 15:46:18 +08:00
parent 79a6f897d9
commit 815cf1ad1e
4 changed files with 28 additions and 14 deletions

View file

@ -58,11 +58,11 @@ let definedBuildSeqs = {};
function createMake(mapping) {
const { hives, dir, filename, cm, custom } = mapping;
let tfname = `$(BUILD)/${filename}.0.otd`;
let target = `$(DIST)/${dir}/${filename}.ttf`;
let cmTarget = `$(BUILD)/${filename}.charmap`;
let woffTarget = `$(DIST)/${dir}/web/${filename}.woff`;
let woff2Target = `$(DIST)/${dir}/web/${filename}.woff2`;
let target = `$(DIST)/${dir}/ttf/${filename}.ttf`;
let woffTarget = `$(DIST)/${dir}/woff/${filename}.woff`;
let woff2Target = `$(DIST)/${dir}/woff2/${filename}.woff2`;
let buf = "";
if (!definedBuildSeqs[tfname]) {
@ -73,7 +73,7 @@ ${tfname} : ${custom || ''} $(SCRIPTS) | $(BUILD) $(DIST)/${dir}/
definedBuildSeqs[tfname] = true;
}
buf += `
${target} : ${tfname} | $(DIST)/${dir}/
${target} : ${tfname} | $(DIST)/${dir}/ttf/
@echo Hinting and optimizing ${tfname} '->' $@
@otfccbuild ${tfname} -o $(BUILD)/${filename}.1.ttf --keep-average-char-width
@ttfautohint $(BUILD)/${filename}.1.ttf $(BUILD)/${filename}.2.ttf
@ -82,11 +82,11 @@ ${target} : ${tfname} | $(DIST)/${dir}/
@rm $(BUILD)/${filename}.1.ttf $(BUILD)/${filename}.2.ttf $(BUILD)/${filename}.2.otd`;
buf += `
${woffTarget} : ${target} | $(DIST)/${dir}/web/
${woffTarget} : ${target} | $(DIST)/${dir}/woff/
sfnt2woff $<
mv $(subst .ttf,.woff,$<) $@`;
buf += `
${woff2Target} : ${target} | $(DIST)/${dir}/web/
${woff2Target} : ${target} | $(DIST)/${dir}/woff2/
woff2_compress $<
mv $(subst .ttf,.woff2,$<) $@`;
@ -145,7 +145,13 @@ for (let dg of designGroups) {
$(DIST)/${groupMapping.dir}/ : | $(DIST)/
-@mkdir -p $@`);
makes.push(`
$(DIST)/${groupMapping.dir}/web/ : | $(DIST)/${groupMapping.dir}/
$(DIST)/${groupMapping.dir}/ttf/ : | $(DIST)/${groupMapping.dir}/
-@mkdir -p $@`);
makes.push(`
$(DIST)/${groupMapping.dir}/woff/ : | $(DIST)/${groupMapping.dir}/
-@mkdir -p $@`);
makes.push(`
$(DIST)/${groupMapping.dir}/woff2/ : | $(DIST)/${groupMapping.dir}/
-@mkdir -p $@`);
for (let weight of weights)
for (let slantness of slantnesses) {
@ -170,8 +176,8 @@ $(DIST)/${groupMapping.dir}/web/ : | $(DIST)/${groupMapping.dir}/
makes.push(`fonts-${dg.name}-italic : ${groupTargets.italic.join(' ')}`);
makes.push(`fonts-${dg.name}-oblique : ${groupTargets.oblique.join(' ')}`);
makes.push(`web-${dg.name} : ${groupTargets.woff.join(' ')} ${groupTargets.woff2.join(' ')}`);
makes.push(`$(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip : fonts-${dg.name} | $(ARCHIVEDIR)/
cd $(DIST)/${groupMapping.dir}/ && 7z a -tzip -mx=9 ../../$@ ./*.ttf`);
makes.push(`$(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip : fonts-${dg.name} web-${dg.name} | $(ARCHIVEDIR)/
cd $(DIST)/${groupMapping.dir}/ && 7z a -tzip -r -mx=9 ../../$@ ./`);
makes.push(`archive-${dg.name} : $(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip`);
}

View file

@ -1,7 +1,7 @@
define-operator "~>" 880 'right' : syntax-rules
`(@l ~> @r) `{.left @l .right @r}
define progLigNameMap
export : define [progLigNameMap] : object
# language-specific tags
.XML_ {'brst', 'plusplus', 'logic', 'ml'}
.XML0 {'brst', 'plusplus', 'logic', 'ml'}
@ -20,6 +20,7 @@ define progLigNameMap
# "special" tags
.ZALE {'arrowZALE'} # <= as arrow
# common feature tags
.XCCC {}
.dlig {'arrow2', 'plusplus', 'dotoper', 'logic', 'brst', 'dlig'}
.calt {}
@ -56,8 +57,8 @@ local [no_period_center] ({'period.center'} ~> {'period'})
define preserved null
export all : define [buildLigations chain-rule lookupOrder commonList features lookups] : foreach [ ligationFeatureName : items-of : Object.keys progLigNameMap] : do
local mappedFeature : progLigNameMap.(ligationFeatureName) || {}
export : define [buildLigations chain-rule lookupOrder commonList features lookups plm] : foreach [ ligationFeatureName : items-of : Object.keys plm] : do
local mappedFeature : plm.(ligationFeatureName) || {}
local ligationLookupName : 'lig_' + ligationFeatureName + '-' + mappedFeature
define [hasLG ln] : [mappedFeature.indexOf ln] >= 0

View file

@ -1,7 +1,7 @@
import 'topsort' as topsort
import '../support/glyph' as Glyph
import '../support/transform' as Transform
import './feature/ligation' as buildLigations
import [progLigNameMap buildLigations] from './feature/ligation'
import './feature/opbd' as buildOPBD
import './feature/ccmp' as buildCCMP
@ -66,7 +66,10 @@ define [buildGSUB para glyphList markGlyphs] : begin
return subtable
buildCCMP chain-rule markGlyphs commonList features lookups
if (para.spacing > 0) : buildLigations chain-rule lookupOrder commonList features lookups
if (para.spacing > 0) : do
define plm : progLigNameMap
set plm.calt : plm.(para.defLigSet) || {}
buildLigations chain-rule lookupOrder commonList features lookups plm
if (para.spacing > 0) : buildOPBD chain-rule lookupOrder commonList features lookups
# locl, SRB

View file

@ -334,6 +334,10 @@ stressFW = true
[stress-fw.adds]
family = " StFW"
# Default ligation set configuration
[default-ligset-haskell]
defLigSet = "XHS0"
# Compatibility PUA ligature sample
# [[iosevka.compLig]]
# unicode = 57600 # 0xE100