Permalink
Browse files

building refactor.

  • Loading branch information...
be5invis committed Apr 1, 2017
1 parent 4cc6432 commit 34a80fdf8f2188e064b351f94cc59a0e80e1a074
View
@@ -6,11 +6,20 @@
If you have problem when building Iosevka, please provide these informations:
* Your Node.js version:
* Your results of `npm list`
* Your _otfcc_ version:
* Your FontForge version:
* Your `make` version:
* Your results of `npm list`:
```
paste here
```
* Your `parameters.toml`:
```
paste here
```
* Your results of `make -d --no-builtin-rules`:
```
paste here
```
---
Describe your problem here. Provide pictures and files if necessary.
View
@@ -38,10 +38,10 @@ Iosevka’s default ligation set is assigned to `calt` feature, though not all o
To build Iosevka you should:
1. Ensure that [`nodejs`](http://nodejs.org) (≥ 6.0), [`ttfautohint`](http://www.freetype.org/ttfautohint/), [`otfcc`](https://github.com/caryll/otfcc) (≥ 0.4.4) and `make` are runnable in your terminal.
- Windows users may need to install MinGW and make \*nix utilities accessible (`mkdir.exe`, `cp.exe`, `cat.exe` and `rm.exe`, in particular) from Command Prompt. Utilities provided by [Git for Windows](https://git-for-windows.github.io/) works fine.
1. Ensure that [`nodejs`](http://nodejs.org) (≥ 6.0), [`ttfautohint`](http://www.freetype.org/ttfautohint/), [`otfcc`](https://github.com/caryll/otfcc) (≥ 0.4.4) and GNU `make` (≥ 4.1; BSD `make` may not work) are runnable in your terminal.
- Windows users may need to install MinGW and make POSIX utilities accessible (`mkdir.exe`, `cp.exe`, `cat.exe` and `rm.exe`, in particular) from Command Prompt. Utilities provided by [Git for Windows](https://git-for-windows.github.io/) or MSYS2 works fine.
2. Install necessary libs by `npm install`. If you’ve installed them, upgrade to the latest.
3. `make`.
3. `make` (or `gmake`).
You will find TTFs in the `dist/` directory.
@@ -102,8 +102,8 @@ The current available styles are:
* `v-a-doublestorey` : Double-storey `a` (default for upright and oblique).
* `v-a-singlestorey` : Single-storey `a` (default for italic).
* Styles for letter `g`:
* `v-g-doublestorey` : Double-storey `g` (default).
* `v-g-singlestorey` : Single-storey `g`.
* `v-g-doublestorey` : Double-storey `g` (default for upright and oblique).
* `v-g-singlestorey` : Single-storey `g` (default for italic).
* `v-g-opendoublestorey` : Open Double-storey `g`.
* Styles for letter `m`:
* `v-m-longleg` : `m` with long middle leg (default).
View
@@ -4,7 +4,7 @@ var path = require("path");
// var TTFWriter = require('node-sfnt').TTFWriter;
var argv = require("yargs").argv;
var buildGlyphs = require("./buildglyphs.js");
var parameters = require("./parameters");
var parameters = require("./support/parameters");
var toml = require("toml");
var Glyph = require("./support/glyph");
@@ -22,11 +22,30 @@ function hasv(obj) {
}
function mergeVSHive(_target, source) {
if (!source) return _target;
let __cvmap = objectAssign({}, _target.__cvmap, source.__cvmap);
let target = objectAssign(_target, source);
target.__cvmap = __cvmap;
return target;
}
function produceComposite(vs, para, dflt, g) {
let sel = objectAssign({}, dflt);
if (g.design) for (let h of g.design) {
sel = mergeVSHive(sel, vs[h]);
}
if (!para.isItalic && g.upright) {
for (let h of g.upright) {
sel = mergeVSHive(sel, vs[h]);
}
}
if (para.isItalic && g.italic) {
for (let h of g.italic) {
sel = mergeVSHive(sel, vs[h]);
}
}
sel.__isComposite = true;
return sel;
}
function formVariantData(data, para) {
const vs = {};
// simple selector
@@ -43,32 +62,10 @@ function formVariantData(data, para) {
if (tag) vs[tag] = hive;
}
// default selector
vs.default = {};
for (let slantness in data.default) {
if (slantness !== (para.isItalic ? 'italic' : 'upright')) continue;
let sel = vs.default || {};
for (let h of data.default.upright) {
sel = mergeVSHive(sel, vs[h]);
}
if (para.isItalic) {
for (let h of data.default.italic) {
sel = mergeVSHive(sel, vs[h]);
}
}
vs.default = sel;
}
vs.default = produceComposite(vs, para, {}, data.default);
// ss## selector
for (let k in data.composite) {
let sel = mergeVSHive({}, vs.default);
for (let h of data.composite[k].upright) {
sel = mergeVSHive(sel, vs[h]);
}
if (para.isItalic && data.composite[k].italic) {
for (let h of data.composite[k].italic) {
sel = mergeVSHive(sel, vs[h]);
}
}
vs[k] = sel;
vs[k] = produceComposite(vs, para, vs.default, data.composite[k]);
}
return vs;
}
View
@@ -18,18 +18,16 @@ export : define [apply] : begin
set introduced true
return : if introduced fs null
define [select-variant name unicode default featureSelector] : begin
define [select-variant name unicode] : begin
if (pickHash && [not pickHash.(name)]) : return nothing
local variant : variantSelector.(name) || default || para.defaultVariant.(name)
local variant : variantSelector.(name) || para.defaultVariant.(name)
if [not variant] : begin
throw : new Error "Variant for \(name) is not assigned."
local chosenGlyph glyphs.((name + '.' + variant))
create-glyph name : glyph-construction
include chosenGlyph AS_BASE ALSO_METRICS
if unicode : assign-unicode unicode
if featureSelector
: then : set currentGlyph.featureSelector featureSelector
: else : set currentGlyph.featureSelector : queryFeatureSelector name para
set currentGlyph.featureSelector : queryFeatureSelector name para
set this.cmpPriority chosenGlyph.cmpPriority
define [italic-variant name unicode] : create-glyph name : glyph-construction
@@ -826,29 +826,33 @@ export : define [apply] : begin
save 'smcpY' 0x28F
### y
local useCurlyBottom : para.isItalic || SLAB
local px1 0.84
local py1 : linreg 18 0.8 126 0.76 STROKE
local px2 0.95
local py20 0.88
local py2 : if SLAB [linreg 18 0.97 126 0.85 STROKE] py20
local py2 : if useCurlyBottom [linreg 18 0.97 126 0.85 STROKE] py20
local pds 0.05
local pds2 0.01
local dpy1 : (1 - [linreg (1 - px2) (1 - py2) px1 py1 1]) / (1 - py1)
local dpy20 : (1 - [linreg (1 - px1) (1 - py1) px2 py20 1]) / (1 - py20)
local dpy2 : (1 - [linreg (1 - px1) (1 - py1) px2 py2 1]) / (1 - py2)
local yrstrokel0 : MIDDLE - WIDTH * 0.1
local yrstrokel : MIDDLE - WIDTH * [if SLAB 0.15 0.1] + [if SLAB HALFSTROKE 0]
local yrstrokel : MIDDLE - WIDTH * [if useCurlyBottom 0.15 0.1] + [if useCurlyBottom HALFSTROKE 0]
local yrstroker : RIGHTSB - HALFSTROKE * HVCONTRAST
local yshrink : linreg 18 1 126 0.85 STROKE
local slabysize : JUT * [linreg 18 0.85 126 1 STROKE]
local slabysize JUT
local slabyvx : linreg 18 0.7 126 0.5 STROKE
define [yBaseKnots top bottom] : begin
local ds : (top - bottom) * pds
local ds2 : (top - bottom) * pds2 + [if SLAB (slabysize * slabyvx) 0]
local ds2 : (top - bottom) * pds2 + [if useCurlyBottom (slabysize * slabyvx) 0]
return : list
flat [mix yrstrokel yrstroker px1] [mix (bottom + ds2) (top - ds) py1]
curl [mix yrstrokel yrstroker (1 - px2)] [mix (bottom + ds2) (top - ds) (1 - py2)] [widths.center : STROKE * [if SLAB yshrink 1]]
if SLAB : then : list
curl
mix yrstrokel yrstroker (1 - px2)
mix (bottom + ds2) (top - ds) (1 - py2)
widths.center : STROKE * [if useCurlyBottom yshrink 1]
if useCurlyBottom : then : list
flat (yrstrokel - slabysize) (bottom + HALFSTROKE) [widths.center]
curl [Math.min (yrstrokel - slabysize - 0.1) (yrstrokel - HALFSTROKE - JUT)] (bottom + HALFSTROKE)
: else : list
@@ -858,7 +862,7 @@ export : define [apply] : begin
define [SmallYShape top bottom] : glyph-construction
local ds : (top - bottom) * pds
local ds2 : (top - bottom) * pds2 + [if SLAB (slabysize * slabyvx) 0]
local ds2 : (top - bottom) * pds2 + [if useCurlyBottom (slabysize * slabyvx) 0]
include : tagged 'strokeR' : dispiro
widths.center
flat yrstroker top [heading DOWNWARD]
@@ -872,7 +876,10 @@ export : define [apply] : begin
curl (WIDTH - yrstroker) (top - ds) [heading DOWNWARD]
quadcontrols 0 dpy1 16
flat [mix (WIDTH - yrstrokel) (WIDTH - yrstroker) px1] [mix (bottom + ds2) (top - ds) py1]
curl MIDDLE [mix (bottom + ds2) (top - ds) [linreg (1 - px2) (1 - py2) px1 py1 ((MIDDLE - yrstrokel) / (yrstroker - yrstrokel))]] [widths.center (STROKE * yshrink)]
curl MIDDLE
mix (bottom + ds2) (top - ds)
linreg (1 - px2) (1 - py2) px1 py1 ((MIDDLE - yrstrokel) / (yrstroker - yrstrokel))
widths.center (STROKE * yshrink)
end [function : set this.cleanmore true]
if SLAB : begin
include : AIVSerifs top
@@ -882,7 +889,6 @@ export : define [apply] : begin
include : SmallYShape XH DESCENDER
save 'y.upright'
sketch # y.italic
if SLAB
: then
@@ -86,7 +86,7 @@ export : define [apply] : begin
save id unicode
arrow ArrowShape 'arrowleft' 0x2190 arrowRSB parenMid SB parenMid
arrow ArrowShape 'arrowright.dflt' null SB parenMid arrowRSB parenMid
arrow ArrowShape 'arrowright' 0x2192 SB parenMid arrowRSB parenMid
arrow ArrowShape 'arrowup' 0x2191 arrowMidX arrowBot arrowMidX arrowTop
arrow ArrowShape 'arrowdown' 0x2193 arrowMidX arrowTop arrowMidX arrowBot
arrow ArrowShape 'hwarrowleft' null hwArrowRSB parenMid SB parenMid nothing WIDTH
@@ -98,16 +98,6 @@ export : define [apply] : begin
arrow ArrowShape 'arrowdownright' 0x2198 SB arrowTop arrowRSB arrowBot
arrow ArrowShape 'arrowdownleft' 0x2199 arrowRSB arrowTop SB arrowBot
arrow ArrowShape 'arrowright.IDT2' null SB parenMid (WIDTH * 2 - SB) parenMid WIDTH
arrow ArrowShape 'arrowright.IDT4' null SB parenMid (WIDTH * 4 - SB) parenMid WIDTH
arrow ArrowShape 'arrowright.IDT8' null SB parenMid (WIDTH * 8 - SB) parenMid WIDTH
select-variant 'arrowright' 0x2192 'dflt' {
.IDT2 'arrowright.IDT2'
.IDT4 'arrowright.IDT4'
.IDT8 'arrowright.IDT8'
}
doublearrow ArrowShape 'arrowleftright' 0x2194 SB parenMid arrowRSB parenMid
doublearrow ArrowShape 'arrowupdown' 0x2195 arrowMidX arrowTop arrowMidX arrowBot
doublearrow ArrowShape 'arrowupleftdownright' 0x2921 SB arrowTop arrowRSB arrowBot
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
130 makefile
@@ -1,36 +1,28 @@
VERSION = 1.12.0
start : __start
BUILD = build
DIST = dist
ARCHIVEDIR = release-archives
include utility/makefile.dirs.mk
include utility/makefile.scripts.mk
.SECONDARY : scripts
.PHONY : pages test release sample-images _start web fw custom custom-web custom-config
_start : __default
$(BUILD)/ :
-@mkdir -p $@
$(DIST)/ :
-@mkdir -p $@
$(ARCHIVEDIR)/ :
-@mkdir -p $@
# Standard
$(BUILD)/targets.mk : maker.js $(SCRIPTS) | $(BUILD)/
node maker.js > $@
GENERATE = @node --expose-gc generator
__start : $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.standard.mk __default
###################################################################################################
# Standard builds
release : $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.standard.mk release
$(BUILD)/targets.mk : maker.js $(SCRIPTS) | $(BUILD)/
node maker.js > $@
include $(BUILD)/targets.mk
test : $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.standard.mk test
web : web-sans web-slab
fw : $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.standard.mk fw
###################################################################################################
# Custom builds
sample-images :
@$(MAKE) -f utility/makefile.standard.mk sample-images
# Custom
ifndef set
set = custom
endif
@@ -47,88 +39,16 @@ ifndef oblique
oblique = normal
endif
CREATECONFIG = node maker.js --custom $(set) --design '$(design)' --upright '$(upright)' --italic '$(italic)' --oblique '$(oblique)' > $(BUILD)/targets-$(set).mk
custom-config : | $(BUILD)/
$(BUILD)/targets-$(set).mk : | $(BUILD)/
$(CREATECONFIG)
custom :
@make fonts-customized-$(set) __IOSEVKA_CUSTOM_BUILD__=true
custom-web :
@make web-customized-$(set) __IOSEVKA_CUSTOM_BUILD__=true
ifdef __IOSEVKA_CUSTOM_BUILD__
include $(BUILD)/targets-$(set).mk
endif
###################################################################################################
# Iosevka standard release scripts
release : __release pages sample-images
test : fonts-sans fonts-slab
cp dist/iosevka/*.ttf testdrive/assets/
cp dist/iosevka-slab/*.ttf testdrive/assets/
cp build/iosevka-regular.charmap testdrive/assets/
cp build/iosevka-slab-regular.charmap testdrive/assets/
pages : fonts-sans fonts-slab web-sans web-slab
cp dist/iosevka/*.ttf pages/assets/
cp dist/iosevka/web/* pages/assets/
cp dist/iosevka-slab/*.ttf pages/assets/
cp dist/iosevka-slab/web/* pages/assets/
cp build/iosevka-regular.charmap pages/assets/
cp build/iosevka-slab-regular.charmap pages/assets/
fw : ttc
d-snapshot : fonts-sans fonts-slab web-sans web-slab
cp dist/iosevka/*.ttf snapshot/assets/
cp dist/iosevka/web/* snapshot/assets/
cp dist/iosevka-slab/*.ttf snapshot/assets/
cp dist/iosevka-slab/web/* snapshot/assets/
cp build/iosevka-regular.charmap snapshot/assets/
cp build/iosevka-slab-regular.charmap snapshot/assets/
electronsnaps1: d-snapshot
cd snapshot && stylus index.styl -c
cd snapshot && electron getsnap.js --dir ../images
images/opentype.png: electronsnaps1
optipng $@
images/languages.png: electronsnaps1
optipng $@
images/preview-all.png: electronsnaps1
optipng $@
images/weights.png: electronsnaps1
optipng $@
images/variants.png: electronsnaps1
optipng $@
images/matrix.png: electronsnaps1
optipng $@
images/family.png: electronsnaps1
optipng $@
sample-images: images/family.png images/matrix.png images/weights.png images/variants.png images/opentype.png images/languages.png images/preview-all.png
###################################################################################################
# Support Files
# DO NOT CHANGE
PATELC = node ./node_modules/patel/bin/patel-c
GLYPH_SEGMENTS = glyphs/common-shapes.js glyphs/overmarks.js glyphs/letters-unified-basic.js glyphs/letters-unified-extended.js glyphs/numbers.js glyphs/symbol-punctuation.js glyphs/symbol-math.js glyphs/symbol-letter.js glyphs/symbol-geometric.js glyphs/symbol-other.js glyphs/symbol-braille.js glyphs/autobuilds.js buildglyphs.js
SUPPORT_FILES_FROM_PTL = support/glyph.js support/spiroexpand.js support/spirokit.js parameters.js support/anchor.js support/point.js support/transform.js support/utils.js meta/aesthetics.js meta/naming.js meta/features.js meta/feature/ligation.js meta/feature/opbd.js meta/feature/ccmp.js
SUPPORT_FILES_JS = generator.js emptyfont.toml parameters.toml variants.toml support/fairify.js support/autoref.js
SUPPORT_FILES = $(SUPPORT_FILES_FROM_PTL) $(SUPPORT_FILES_JS)
SCRIPTS = $(SUPPORT_FILES) $(GLYPH_SEGMENTS)
SCRIPTS_FROM_PTL = $(SUPPORT_FILES_FROM_PTL) $(GLYPH_SEGMENTS)
$(SUPPORT_FILES_FROM_PTL) : %.js : %.ptl meta/macros.ptl
$(PATELC) --optimize --strict $< -o $@
$(GLYPH_SEGMENTS) : %.js : %.ptl meta/macros.ptl $(SUPPORT_FILES_FROM_PTL) $(SUPPORT_FILES_JS)
$(PATELC) --optimize --strict $< -o $@
custom-config : $(BUILD)/targets-$(set).mk
cleanscripts :
-@rm $(SCRIPTS_FROM_PTL)
scripts : $(SCRIPTS)
export set
custom : $(BUILD)/targets-$(set).mk $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.custom.mk fonts-customized-$(set) __IOSEVKA_CUSTOM_BUILD__=true
custom-web : $(BUILD)/targets-$(set).mk $(BUILD)/targets.mk
@$(MAKE) -f utility/makefile.custom.mk web-customized-$(set) __IOSEVKA_CUSTOM_BUILD__=true
Oops, something went wrong.

0 comments on commit 34a80fd

Please sign in to comment.