new build script

This commit is contained in:
be5invis 2017-01-25 16:11:51 +08:00
parent 6703ab7ebe
commit ca4324449d
17 changed files with 368 additions and 677 deletions

View File

@ -38,7 +38,7 @@ Iosevkas default ligation set is assigned to `calt` feature, though not all o
To build Iosevka you should:
1. Ensure that [`node`](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.
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.
2. Install necessary libs by `npm install`. If youve installed them, upgrade to the latest.
3. `make`.
@ -54,24 +54,36 @@ The `webfonts/` directory is used to build Iosevka for web font uses. To build t
1. Build Iosevka.
2. Ensure that `sfnt2woff` and `woff2_compress` are installed and runnable.
3. `make webfonts`.
3. Run `make web` .
The web fonts will be generated into `dist/webfonts`.
The web fonts will be generated into `dist/iosevka/web` and `dist/iosevka-slab/web`.
## Build Your Own Style
![Styles Preview](https://raw.githubusercontent.com/be5invis/Iosevka/master/images/variants.png)
Iosevka comes with several visual styles, however they are inactive using the default build. To build these variants you should use style variables in the `make` procedure:
Iosevka comes with several visual styles, however they are inactive using the default build. To build these variants, you should perform custom build:
* `STYLE_COMMON` for both uprights and italics,
* `STYLE_UPRIGHT` for upright and oblique, and
* `STYLE_ITALIC` for itaics only.
1. `make custom-config [set=<name>]` with the parameters listed below to create a configuration. The `set=<name>` part is optional, it will be set to `custom` when absent.
2. `make custom [set=<name>]` to acquire your custom font.
- `make custom-web [set=<name>]` is for web fonts.
You can add arbitary styles for these variables, for example, `make STYLE_UPRIGHT='v-l-zshaped v-i-zshaped'` to create a variant with Z-shaped letter `l` and `i` for uprights.
The first step, `make custom-config` takes following parameters to set styles of your custom build. All of them are optional, and would default to Iosevkas default configuration:
* `design='<styles>'`, styles for your custom font set.
* `upright='<styles>'`, styles for uprights only.
* `italic='<styles>'`, styles for italics only.
* `oblique='<styles>'`, styles for obliques only.
You can add arbitary styles for these variables, for example, `make custom-config upright='v-l-zshaped v-i-zshaped' && make custom` will create a variant with Z-shaped letter `l` and `i` for uprights.
The current avaliable styles are:
* Styles for general shape:
* `sans` : Sans serif (default).
* `slab` : Slab serif. When present, the family of your font would be `Iosevka Slab`.
* Styles related to ligations
- `term` : Disable ligations. When this style is present, the font built will not contain ligatures, and its family name will be set to `Iosevka Term`. In case of your OS or editor cannot handle ligatures correctly, you can disable ligations with it.
* Styles for letter `l`:
* `v-l-hooky` : Hooky `l`.
* `v-l-zshaped` : Z-shaped `l`.
@ -117,8 +129,6 @@ The current avaliable styles are:
* Styles for curly brackets ({})
* `v-brace-straight` : More straight braces.
* `v-brace-curly` : More curly braces (default).
* Styles related to ligations
* `term` : Disable ligations. When this style is present, the font built will not contain ligatures, and its family name will be set to `Iosevka Term`. In case of your OS or editor cannot handle ligatures correctly, you can disable ligations using it.
## Release Notes

View File

@ -58,95 +58,6 @@ if (argv.charmap) {
})();
}
if (argv.svg) {
(function () {
console.log(" Writing outline as SVG -> " + argv.svg);
var foundNaN = false;
var glyfname = "";
function mix(a, b, p) {
return a + (b - a) * p;
}
function toSVGPath(glyph) {
var buf = "";
foundNaN = false;
glyfname = glyph.name;
if (glyph.contours)
for (var j = 0; j < glyph.contours.length; j++) {
buf += Glyph.contourToSVGPath(glyph.contours[j], false);
}
return buf;
}
var svg = '<?xml version="1.0" encoding="utf-8"?>'
+ '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >'
+ '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">'
+ '<defs><font id="' + font.name.postScriptName + '">';
var skew = (argv.uprightify ? 1 : 0) * Math.tan((font.post.italicAngle || 0) / 180 * Math.PI);
var scale = (argv.upm || 1000) / 1000;
svg += '<font-face font-family="' + font.name.fontFamily
+ '" font-weight="' + font.OS_2.usWeightClass
+ '" font-stretch="normal" units-per-em="'
+ (1000 * scale) + '"/>';
for (var j = 0; j < font.glyf.length; j++) {
var g = font.glyf[j];
if (g.contours) {
for (var k = 0; k < g.contours.length; k++) {
var contour = g.contours[k];
for (var p = 0; p < contour.length; p++) {
contour[p].x += contour[p].y * skew;
contour[p].x *= scale;
contour[p].y *= scale;
}
}
g.advanceWidth *= scale;
Glyph.prototype.cleanup.call(g, 0.25);
}
var gd = "<" + (j === 0 ? "missing-glyph" : "glyph")
+ ' glyph-name="' + g.name
+ '" horiz-adv-x="' + g.advanceWidth + '" '
+ (g.unicode && g.unicode.length ? 'unicode="&#x' + g.unicode[0].toString(16) + ';"' : "")
+ ' d="' + toSVGPath(g) + '" />\n';
svg += gd;
}
svg += "</font></defs></svg>";
fs.writeFileSync(argv.svg, svg, "utf-8");
})();
}
var StatusBar = function (message, n) {
this.message = message;
this.total = n;
this.progress = 0;
this.lastUpdate = new Date();
};
StatusBar.prototype.update = function (j) {
var j0 = this.progress;
var LEN = 25;
this.progress = j;
if (Math.round(this.progress / this.total * LEN) !== Math.round(j0 / this.total * LEN)) {
var filled = Math.round(this.progress / this.total * LEN);
var remain = LEN - filled;
var pg = Array(filled + 1).join("#") + Array(remain + 1).join(" ");
var d = new Date();
if (!remain || d - this.lastUpdate > 500) {
process.stderr.write(" [" + pg + "] " + this.message + "\n");
this.lastUpdate = d;
}
}
};
StatusBar.each = function (message, a, f) {
var bar = new StatusBar(message, a.length);
a.forEach(function (x, j) {
var r = f.apply(this, arguments);
bar.update(j + 1);
return r;
});
};
if (argv.o) {
console.log(" Writing output -> " + argv.o);
@ -156,7 +67,7 @@ if (argv.o) {
// autoref
autoref(font.glyf);
// regulate
StatusBar.each("Regulate", font.glyf, (g) => {
font.glyf.forEach((g) => {
if (g.contours) {
for (var k = 0; k < g.contours.length; k++) {
var contour = g.contours[k];
@ -193,12 +104,14 @@ if (argv.o) {
g.contours = c1;
}
});
StatusBar.each("Remove Overlap", font.glyf, (g) => {
// overlap removal
font.glyf.forEach((g) => {
if (g.contours) {
g.contours = caryllShapeOps.removeOverlap(g.contours, 1, 2048, true);
}
});
StatusBar.each("Finalize", font.glyf, (g) => {
// finalize
font.glyf.forEach((g) => {
if (g.contours) {
Glyph.prototype.cleanup.call(g, 0.25);
g.contours = c2q.contours(g.contours);
@ -220,14 +133,3 @@ if (argv.o) {
font.glyfMap = null;
fs.writeFileSync(argv.o, JSON.stringify(font));
}
if (argv.meta) {
(function () {
console.log(" Writing metadata as JSON -> " + argv.meta);
if (argv.svg) {
font.glyf = null;
font.glyfMap = null;
}
fs.writeFileSync(argv.meta, JSON.stringify(font));
})();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 KiB

After

Width:  |  Height:  |  Size: 765 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 267 KiB

409
makefile
View File

@ -1,282 +1,127 @@
default: d-fonts
ifeq ($(config),default)
TARGET=sans
ARCPREFIX =01.
else ifeq ($(config),term)
TARGET=sans
ARCPREFIX =02.
SUFFIX = -term
STYLE_COMMON = term
NOCHARMAP = true
else ifeq ($(config),cc)
TARGET=sans
ARCPREFIX = 03.
SUFFIX = -cc
STYLE_COMMON=cc
NOCHARMAP=true
else ifeq ($(config),slab)
TARGET=slab
ARCPREFIX=04.
else ifeq ($(config),term-slab)
TARGET=slab
ARCPREFIX=05.
SUFFIX=-term
STYLE_COMMON=term
NOCHARMAP=true
else ifeq ($(config),cc-slab)
TARGET=slab
ARCPREFIX=06.
SUFFIX=-cc
STYLE_COMMON=cc
NOCHARMAP=true
else ifeq ($(config),hooky)
TARGET=sans
ARCPREFIX=07.
SUFFIX=-hooky
STYLE_UPRIGHT=v-l-hooky v-i-hooky
NOCHARMAP=true
else ifeq ($(config),hooky-term)
TARGET=sans
ARCPREFIX=08.
SUFFIX=-term-hooky
STYLE_COMMON=term
STYLE_UPRIGHT=v-l-hooky v-i-hooky
NOCHARMAP=true
else ifeq ($(config),zshaped)
TARGET=sans
ARCPREFIX=09.
SUFFIX=-zshaped
STYLE_UPRIGHT=v-l-zshaped v-i-zshaped
NOCHARMAP=true
else ifeq ($(config),zshaped-term)
TARGET=sans
ARCPREFIX=10.
SUFFIX=-term-zshaped
STYLE_COMMON=term
STYLE_UPRIGHT=v-l-zshaped v-i-zshaped
NOCHARMAP=true
else ifeq ($(config),d-sans)
TARGET=sans
else ifeq ($(config),d-slab)
TARGET=slab
else
TARGET=sans
endif
include makesupport.mk
ifeq ($(TARGET),slab)
PARAM = SUFFIX='$(SUFFIX)-slab' STYLE_SUFFIX='slab'
else
PARAM = SUFFIX='$(SUFFIX)' VERSION='$(VERSION)'
endif
export VERSION
export VARNAME
export STYLE_COMMON
export STYLE_UPRIGHT
export STYLE_ITALIC
export VERSION
export ARCPREFIX
export NOCHARMAP
export NOLIG
export DONTREF
export DONTHINT
### Sometimes make will freak out and report ACCESS VIOLATION for me... so i have to add some repeation
LOOPS = 0 1 2
# svgs
svgs : $(SCRIPTS) | $(OBJDIR) dist
@$(MAKE) -f onegroup.mk svgs $(PARAM)
# ttfs
fonts : $(SCRIPTS) | $(OBJDIR) dist
@$(MAKE) -f onegroup.mk fonts $(PARAM)
### USED FOR TESTING AND RELEASING
### DO NOT TOUCH!
# Testdrive
testdrive : fonts
@$(MAKE) -f onegroup.mk test $(PARAM)
# Webfonts
dist/webfonts : | dist
@- mkdir $@
dist/webfonts/assets : | dist/webfonts
@- mkdir $@
dist/ttc : | dist
@- mkdir $@
webfont-pkg : fonts | dist/webfonts/assets
@$(MAKE) -f onegroup.mk webfonts $(PARAM)
# Snapshot
x-snapshot : webfont-pkg | snapshot/assets
@$(MAKE) -f onegroup.mk snapshot $(PARAM)
# Pages
pages/index.css : pages/index.styl
stylus $<
pages : fonts pages/index.css
@$(MAKE) -f onegroup.mk pages $(PARAM)
# Archives
archives : fonts
@$(MAKE) -f onegroup.mk archives $(PARAM)
# Release building commands
standard-styles = default term cc slab term-slab cc-slab hooky hooky-term zshaped zshaped-term d-sans d-slab
fonts-styles = $(foreach style,$(standard-styles),fonts-$(style))
testdrive-styles = $(foreach style,$(standard-styles),testdrive-$(style))
archives-styles = $(foreach style,$(standard-styles),archives-$(style))
pages-styles = $(foreach style,$(standard-styles),pages-$(style))
webfont-pkg-styles = $(foreach style,$(standard-styles),webfont-pkg-$(style))
x-snapshot-styles = $(foreach style,$(standard-styles),x-snapshot-$(style))
$(fonts-styles) : fonts-% : $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) fonts config=$(subst fonts-,,$@)
$(testdrive-styles) : testdrive-% : fonts-% $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) testdrive config=$(subst testdrive-,,$@)
$(archives-styles) : archives-% : fonts-% $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) archives config=$(subst archives-,,$@)
$(pages-styles) : pages-% : fonts-% $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) pages config=$(subst pages-,,$@)
$(webfont-pkg-styles) : webfont-pkg-% : fonts-% $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) webfont-pkg config=$(subst webfont-pkg-,,$@)
$(x-snapshot-styles) : x-snapshot-% : fonts-% $(SCRIPTS) | $(OBJDIR) dist
$(MAKE) x-snapshot config=$(subst x-snapshot-,,$@)
x-archives-bundled : release-archives/iosevka-pack-$(VERSION).zip release-archives/iosevka-pack-$(VERSION).7z
OTF2OTC1 = otfcc-ttcize -o
# TTC packages
dist/ttc/iosevka-thin.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-thin.ttf dist/02.iosevka-term/iosevka-term-thin.ttf dist/03.iosevka-cc/iosevka-cc-thin.ttf
dist/ttc/iosevka-slab-thin.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-thin.ttf dist/05.iosevka-term-slab/iosevka-term-slab-thin.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-thin.ttf
dist/ttc/iosevka-extralight.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-extralight.ttf dist/02.iosevka-term/iosevka-term-extralight.ttf dist/03.iosevka-cc/iosevka-cc-extralight.ttf
dist/ttc/iosevka-slab-extralight.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-extralight.ttf dist/05.iosevka-term-slab/iosevka-term-slab-extralight.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-extralight.ttf
dist/ttc/iosevka-light.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-light.ttf dist/02.iosevka-term/iosevka-term-light.ttf dist/03.iosevka-cc/iosevka-cc-light.ttf
dist/ttc/iosevka-slab-light.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-light.ttf dist/05.iosevka-term-slab/iosevka-term-slab-light.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-light.ttf
dist/ttc/iosevka-regular.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-regular.ttf dist/02.iosevka-term/iosevka-term-regular.ttf dist/03.iosevka-cc/iosevka-cc-regular.ttf
dist/ttc/iosevka-slab-regular.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-regular.ttf dist/05.iosevka-term-slab/iosevka-term-slab-regular.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-regular.ttf
dist/ttc/iosevka-medium.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-medium.ttf dist/02.iosevka-term/iosevka-term-medium.ttf dist/03.iosevka-cc/iosevka-cc-medium.ttf
dist/ttc/iosevka-slab-medium.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-medium.ttf dist/05.iosevka-term-slab/iosevka-term-slab-medium.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-medium.ttf
dist/ttc/iosevka-bold.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-bold.ttf dist/02.iosevka-term/iosevka-term-bold.ttf dist/03.iosevka-cc/iosevka-cc-bold.ttf
dist/ttc/iosevka-slab-bold.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-bold.ttf dist/05.iosevka-term-slab/iosevka-term-slab-bold.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-bold.ttf
dist/ttc/iosevka-heavy.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-heavy.ttf dist/02.iosevka-term/iosevka-term-heavy.ttf dist/03.iosevka-cc/iosevka-cc-heavy.ttf
dist/ttc/iosevka-slab-heavy.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-heavy.ttf dist/05.iosevka-term-slab/iosevka-term-slab-heavy.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-heavy.ttf
dist/ttc/iosevka-thinitalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-thinitalic.ttf dist/02.iosevka-term/iosevka-term-thinitalic.ttf dist/03.iosevka-cc/iosevka-cc-thinitalic.ttf
dist/ttc/iosevka-slab-thinitalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-thinitalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-thinitalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-thinitalic.ttf
dist/ttc/iosevka-extralightitalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-extralightitalic.ttf dist/02.iosevka-term/iosevka-term-extralightitalic.ttf dist/03.iosevka-cc/iosevka-cc-extralightitalic.ttf
dist/ttc/iosevka-slab-extralightitalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-extralightitalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-extralightitalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-extralightitalic.ttf
dist/ttc/iosevka-lightitalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-lightitalic.ttf dist/02.iosevka-term/iosevka-term-lightitalic.ttf dist/03.iosevka-cc/iosevka-cc-lightitalic.ttf
dist/ttc/iosevka-slab-lightitalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-lightitalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-lightitalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-lightitalic.ttf
dist/ttc/iosevka-italic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-italic.ttf dist/02.iosevka-term/iosevka-term-italic.ttf dist/03.iosevka-cc/iosevka-cc-italic.ttf
dist/ttc/iosevka-slab-italic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-italic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-italic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-italic.ttf
dist/ttc/iosevka-mediumitalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-mediumitalic.ttf dist/02.iosevka-term/iosevka-term-mediumitalic.ttf dist/03.iosevka-cc/iosevka-cc-mediumitalic.ttf
dist/ttc/iosevka-slab-mediumitalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-mediumitalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-mediumitalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-mediumitalic.ttf
dist/ttc/iosevka-bolditalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-bolditalic.ttf dist/02.iosevka-term/iosevka-term-bolditalic.ttf dist/03.iosevka-cc/iosevka-cc-bolditalic.ttf
dist/ttc/iosevka-slab-bolditalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-bolditalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-bolditalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-bolditalic.ttf
dist/ttc/iosevka-heavyitalic.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-heavyitalic.ttf dist/02.iosevka-term/iosevka-term-heavyitalic.ttf dist/03.iosevka-cc/iosevka-cc-heavyitalic.ttf
dist/ttc/iosevka-slab-heavyitalic.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-heavyitalic.ttf dist/05.iosevka-term-slab/iosevka-term-slab-heavyitalic.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-heavyitalic.ttf
dist/ttc/iosevka-thinoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-thinoblique.ttf dist/02.iosevka-term/iosevka-term-thinoblique.ttf dist/03.iosevka-cc/iosevka-cc-thinoblique.ttf
dist/ttc/iosevka-slab-thinoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-thinoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-thinoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-thinoblique.ttf
dist/ttc/iosevka-extralightoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-extralightoblique.ttf dist/02.iosevka-term/iosevka-term-extralightoblique.ttf dist/03.iosevka-cc/iosevka-cc-extralightoblique.ttf
dist/ttc/iosevka-slab-extralightoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-extralightoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-extralightoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-extralightoblique.ttf
dist/ttc/iosevka-lightoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-lightoblique.ttf dist/02.iosevka-term/iosevka-term-lightoblique.ttf dist/03.iosevka-cc/iosevka-cc-lightoblique.ttf
dist/ttc/iosevka-slab-lightoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-lightoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-lightoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-lightoblique.ttf
dist/ttc/iosevka-oblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-oblique.ttf dist/02.iosevka-term/iosevka-term-oblique.ttf dist/03.iosevka-cc/iosevka-cc-oblique.ttf
dist/ttc/iosevka-slab-oblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-oblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-oblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-oblique.ttf
dist/ttc/iosevka-mediumoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-mediumoblique.ttf dist/02.iosevka-term/iosevka-term-mediumoblique.ttf dist/03.iosevka-cc/iosevka-cc-mediumoblique.ttf
dist/ttc/iosevka-slab-mediumoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-mediumoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-mediumoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-mediumoblique.ttf
dist/ttc/iosevka-boldoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-boldoblique.ttf dist/02.iosevka-term/iosevka-term-boldoblique.ttf dist/03.iosevka-cc/iosevka-cc-boldoblique.ttf
dist/ttc/iosevka-slab-boldoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-boldoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-boldoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-boldoblique.ttf
dist/ttc/iosevka-heavyoblique.ttc : fonts-default fonts-term fonts-cc | dist/ttc
$(OTF2OTC1) $@ dist/01.iosevka/iosevka-heavyoblique.ttf dist/02.iosevka-term/iosevka-term-heavyoblique.ttf dist/03.iosevka-cc/iosevka-cc-heavyoblique.ttf
dist/ttc/iosevka-slab-heavyoblique.ttc : fonts-slab fonts-term-slab fonts-cc-slab | dist/ttc
$(OTF2OTC1) $@ dist/04.iosevka-slab/iosevka-slab-heavyoblique.ttf dist/05.iosevka-term-slab/iosevka-term-slab-heavyoblique.ttf dist/06.iosevka-cc-slab/iosevka-cc-slab-heavyoblique.ttf
iosevkattcs : dist/ttc/iosevka-thin.ttc dist/ttc/iosevka-slab-thin.ttc dist/ttc/iosevka-extralight.ttc dist/ttc/iosevka-slab-extralight.ttc dist/ttc/iosevka-light.ttc dist/ttc/iosevka-slab-light.ttc dist/ttc/iosevka-regular.ttc dist/ttc/iosevka-slab-regular.ttc dist/ttc/iosevka-medium.ttc dist/ttc/iosevka-slab-medium.ttc dist/ttc/iosevka-bold.ttc dist/ttc/iosevka-slab-bold.ttc dist/ttc/iosevka-heavy.ttc dist/ttc/iosevka-slab-heavy.ttc dist/ttc/iosevka-thinitalic.ttc dist/ttc/iosevka-slab-thinitalic.ttc dist/ttc/iosevka-extralightitalic.ttc dist/ttc/iosevka-slab-extralightitalic.ttc dist/ttc/iosevka-lightitalic.ttc dist/ttc/iosevka-slab-lightitalic.ttc dist/ttc/iosevka-italic.ttc dist/ttc/iosevka-slab-italic.ttc dist/ttc/iosevka-mediumitalic.ttc dist/ttc/iosevka-slab-mediumitalic.ttc dist/ttc/iosevka-bolditalic.ttc dist/ttc/iosevka-slab-bolditalic.ttc dist/ttc/iosevka-heavyitalic.ttc dist/ttc/iosevka-slab-heavyitalic.ttc dist/ttc/iosevka-thinoblique.ttc dist/ttc/iosevka-slab-thinoblique.ttc dist/ttc/iosevka-extralightoblique.ttc dist/ttc/iosevka-slab-extralightoblique.ttc dist/ttc/iosevka-lightoblique.ttc dist/ttc/iosevka-slab-lightoblique.ttc dist/ttc/iosevka-oblique.ttc dist/ttc/iosevka-slab-oblique.ttc dist/ttc/iosevka-mediumoblique.ttc dist/ttc/iosevka-slab-mediumoblique.ttc dist/ttc/iosevka-boldoblique.ttc dist/ttc/iosevka-slab-boldoblique.ttc dist/ttc/iosevka-heavyoblique.ttc dist/ttc/iosevka-slab-heavyoblique.ttc
release-archives/iosevka-pack-$(VERSION).zip : iosevkattcs
7z a -tzip -mx=9 $@ ./dist/ttc/*
release-archives/iosevka-pack-$(VERSION).7z : iosevkattcs
7z a -t7z -mmt=on -m0=LZMA:a=1:d=1536m:fb=256 $@ ./dist/ttc/*
release-packed : release-archives/iosevka-pack-$(VERSION).zip release-archives/iosevka-pack-$(VERSION).7z
release-all : archives-default archives-term archives-cc \
archives-slab archives-term-slab archives-cc-slab \
archives-hooky archives-zshaped \
archives-hooky-term archives-zshaped-term \
pages-default pages-slab x-archives-bundled
fw : fonts-default fonts-cc fonts-slab fonts-cc-slab fonts-term fonts-term-slab iosevkattcs
d-fonts : fonts-d-sans fonts-d-slab
test : testdrive-d-sans testdrive-d-slab
webfonts : d-webfonts
d-webfonts : webfont-pkg-d-sans webfont-pkg-d-slab
d-snapshot : x-snapshot-d-sans x-snapshot-d-slab
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 $@
sampleimages: images/family.png images/matrix.png images/weights.png images/variants.png images/opentype.png images/languages.png images/preview-all.png
VERSION = 1.11.0
BUILD = build
DIST = dist
ARCHIVEDIR = release-archives
_start : default
$(BUILD)/ :
-@mkdir -p $@
$(DIST)/ :
-@mkdir -p $@
$(ARCHIVEDIR)/ :
-@mkdir -p $@
GENERATE = @node --expose-gc $(NODE_FDT_OPTIONS) generator
###################################################################################################
# Standard builds
$(BUILD)/targets.mk : maker.js $(SCRIPTS) | $(BUILD)/
@node maker.js > $@
include $(BUILD)/targets.mk
web : web-sans web-slab
###################################################################################################
# Custom builds
ifndef set
set = custom
endif
ifndef design
design = sans
endif
ifndef upright
upright = normal
endif
ifndef italic
italic = normal
endif
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)/
$(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 : archive-r-sans archive-r-slab archive-r-sans-term archive-r-sans-cc archive-r-slab-term archive-r-slab-cc archive-r-hooky archive-r-hooky-term archive-r-zshaped archive-r-zshaped-term archive-ttc 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
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
SUPPORT_FILES_JS = generator.js emptyfont.toml parameters.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 $(subst .js,.ptl,$(SUPPORT_FILES_FROM_PTL)) $(SUPPORT_FILES_JS)
$(PATELC) --optimize --strict $< -o $@
cleanscripts :
-@rm $(SCRIPTS_FROM_PTL)
scripts : $(SCRIPTS)

216
maker.js Normal file
View File

@ -0,0 +1,216 @@
const fs = require("fs");
const path = require("path");
const argv = require("yargs").argv;
const weights = ["thin", "extralight", "light", "book", "medium", "bold", "heavy"];
const slantnesses = ["upright", "italic", "oblique"];
const widths = ["term", "normal", "cc"];
const designs = ["sans", "slab"];
function present(x) { return !!x; }
function tofn(a) {
return a.filter(present).join("-");
}
function getMapping(options) {
options = options || {
design: [],
width: "normal",
weight: "book",
slantness: "upright",
styles: {},
dirPrefix: "",
dirSuffix: "",
filePrefix: "",
infix: "",
fileSuffix: ""
};
let design = options.design || [];
let weight = options.weight || "book";
let slantness = options.slantness || "upright";
let hives = ["iosevka"].concat(
design,
["w-" + weight, "s-" + slantness],
(options.styles || {})[slantness] || []
);
let dir = [
options.dirPrefix || "",
"iosevka",
options.infix || tofn(design),
options.dirSuffix || ""
].filter(present).join("-");
let filename = [
options.filePrefix || "",
"iosevka",
options.infix || tofn(design),
options.fileSuffix || "",
(weight === "book" ? (slantness === "upright" ? "regular" : "") : weight) + (slantness === "upright" ? "" : slantness)
].filter(present).join("-");
return {hives, dir, filename, custom: options.custom};
}
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 buf = "";
if (!definedBuildSeqs[tfname]) {
buf += `
${tfname} : $(SCRIPTS) ${custom || ''} | $(BUILD) $(DIST)/${dir}/
@echo Building ${filename} with ${hives.join(' ')}
$(GENERATE) ${hives.join(' ')} -o $@ ${cm ? ('--charmap $(BUILD)/'+filename+'.charmap') :''}`;
definedBuildSeqs[tfname] = true;
}
buf += `
${target} : ${tfname} | $(DIST)/${dir}/
@echo Hinting and optimizing ${tfname} '->' $@
@otfccbuild ${tfname} -o $(BUILD)/${filename}.1.ttf
@ttfautohint $(BUILD)/${filename}.1.ttf $(BUILD)/${filename}.2.ttf
@otfccdump $(BUILD)/${filename}.2.ttf -o $(BUILD)/${filename}.2.otd --pretty
@otfccbuild $(BUILD)/${filename}.2.otd -o $@ -O3 -s
@rm $(BUILD)/${filename}.1.ttf $(BUILD)/${filename}.2.ttf $(BUILD)/${filename}.2.otd`;
buf += `
${woffTarget} : ${target} | $(DIST)/${dir}/web/
sfnt2woff $<
mv $(subst .ttf,.woff,$<) $@`;
buf += `
${woff2Target} : ${target} | $(DIST)/${dir}/web/
woff2_compress $<
mv $(subst .ttf,.woff2,$<) $@`;
return {buf, target, woffTarget, woff2Target, cmTarget};
}
let designGroups = [];
if (argv.custom) {
designGroups = [
{
custom: '$(BUILD)/targets-' + argv.custom + '.mk',
name: "customized-" + argv.custom,
design: argv.design.trim().split(/ +/),
width: argv.width,
infix: argv.custom,
styles: {
upright: argv.upright.trim().split(/ +/),
italic: argv.italic.trim().split(/ +/),
oblique: argv.oblique.trim().split(/ +/)
}
}
];
} else {
designGroups = [
{name: "sans", design: [], dirPrefix: ""},
{name: "slab", design: ["slab"], dirPrefix: ""},
{name: "r-sans", design: [], dirPrefix: "01"},
{name: "r-sans-term", design: ["term"], dirPrefix: "02"},
{name: "r-sans-cc", design: ["cc"], dirPrefix: "03"},
{name: "r-slab", design: ["slab"], dirPrefix: "04"},
{name: "r-slab-term", design: ["term", "slab"], dirPrefix: "05"},
{name: "r-slab-cc", design: ["cc", "slab"], dirPrefix: "06"},
{name: "r-hooky", design: [], infix: "hooky", dirPrefix: "07", styles: {upright: ["v-l-hooky", "v-i-hooky"]}},
{name: "r-hooky-term", design: ["term"], infix: "hooky-term", dirPrefix: "08", styles: {upright: ["v-l-hooky", "v-i-hooky"]}},
{name: "r-zshaped", design: [], infix: "zshaped",dirPrefix: "09", styles: {upright: ["v-l-zshaped", "v-i-zshaped"]}},
{name: "r-zshaped-term", design: ["term"], infix: "zshaped-term", dirPrefix: "10", styles: {upright: ["v-l-zshaped", "v-i-zshaped"]}},
];
}
let makes = [];
for (let dg of designGroups) {
let groupTargets = {
ttf: [],
upright: [],
italic: [],
oblique: [],
woff: [],
woff2: []
};
const groupMapping = getMapping(dg);
makes.push(`
$(DIST)/${groupMapping.dir}/ : | $(DIST)/
-@mkdir -p $@`);
makes.push(`
$(DIST)/${groupMapping.dir}/web/ : | $(DIST)/${groupMapping.dir}/
-@mkdir -p $@`);
for (let weight of weights)
for (let slantness of slantnesses) {
let config = Object.create(dg);
config.weight = weight;
config.slantness = slantness;
const mapping = getMapping(config);
if (weight === "book" && slantness === "upright") {
mapping.cm = true;
}
let {buf, target, woffTarget, woff2Target, cmTarget} = createMake(mapping);
makes.push(buf);
groupTargets.ttf.push(target);
groupTargets[slantness].push(target);
groupTargets.woff.push(woffTarget);
groupTargets.woff2.push(woff2Target);
}
makes.push(`fonts-${dg.name} : ${groupTargets.ttf.join(' ')}`);
makes.push(`fonts-${dg.name}-upright : ${groupTargets.upright.join(' ')}`);
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(`archive-${dg.name} : $(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip`);
}
if (argv.custom) {
} else {
const ttcgroups = [
{groups: [designGroups[2], designGroups[3], designGroups[4]]},
{groups: [designGroups[5], designGroups[6], designGroups[7]]}
];
// ttc
let ttcs = [];
makes.push(`
$(DIST)/ttc/ : | $(DIST)/
-@mkdir -p $@`);
for (let tg of ttcgroups) {
for (let weight of weights) {
for (let slantness of slantnesses) {
let ttctargets = [];
for (let dg of tg.groups) {
let config = Object.create(dg);
config.weight = weight;
config.slantness = slantness;
const mapping = getMapping(config);
ttctargets.push(createMake(mapping).target);
}
let config = Object.create(tg.groups[0]);
config.weight = weight;
config.slantness = slantness;
const mapping = getMapping(config);
ttcs.push(`$(DIST)/ttc/${mapping.filename}.ttc`);
makes.push(`
$(DIST)/ttc/${mapping.filename}.ttc : ${ttctargets.join(' ')} | $(DIST)/ttc/
otfcc-ttcize -o $@ ${ttctargets.join(' ')}
`);
}
}
}
makes.push(`ttc : ${ttcs.join(' ')}`);
makes.push(`$(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip : ttc | $(ARCHIVEDIR)/
cd $(DIST)/ttc/ && 7z a -tzip -mx=9 ../../$@ ./*.ttc`);
makes.push(`archive-ttc : $(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip`);
makes.push(`default : fonts-sans fonts-slab`);
}
console.log(makes.join("\n\n"));

View File

@ -1,26 +0,0 @@
OBJDIR = build
$(OBJDIR) :
@- mkdir $@
dist :
@- mkdir $@
snapshot/assets :
@- mkdir $@
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
SUPPORT_FILES_JS = generator.js emptyfont.toml parameters.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 $(subst .js,.ptl,$(SUPPORT_FILES_FROM_PTL)) $(SUPPORT_FILES_JS)
$(PATELC) --optimize --strict $< -o $@
cleanscripts :
-@rm $(SCRIPTS_FROM_PTL)
scripts : $(SCRIPTS)

View File

@ -1,183 +0,0 @@
default: fonts
TARGETUPM = 1000
include makesupport.mk
PREFIX = $(VARNAME)iosevka$(SUFFIX)
ARCPREFIXB = iosevka$(SUFFIX)
ifdef DONTHINT
HINT = cp
HINT_SUFFIX = --ignore-hints
else
HINT = ttfautohint --increase-x-height=0
endif
ifdef DONTREF
_DONTREF = true
else
_DONTREF =
endif
# Change this when an error reports
# On windows, maybe `2> NUL`.
ifeq ($(OS),Windows_NT)
SHELL = C:\\Windows\\System32\\cmd.exe
SUPPRESS_ERRORS = 2> NUL
PASS = @rem
MKDIR = mkdir.exe
else
SUPPRESS_ERRORS = 2> /dev/null
PASS = @:
MKDIR = mkdir
endif
DISTDIR = dist/$(ARCPREFIX)$(ARCPREFIXB)
$(DISTDIR) : dist
@- $(MKDIR) $@
NODE_FDT = @node --expose-gc $(NODE_FDT_OPTIONS)
NODE = node
UPRIGHT = $(OBJDIR)/$(PREFIX)-thin.ttf $(OBJDIR)/$(PREFIX)-extralight.ttf $(OBJDIR)/$(PREFIX)-light.ttf $(OBJDIR)/$(PREFIX)-regular.ttf $(OBJDIR)/$(PREFIX)-medium.ttf $(OBJDIR)/$(PREFIX)-bold.ttf $(OBJDIR)/$(PREFIX)-heavy.ttf
ITALIC = $(OBJDIR)/$(PREFIX)-thinitalic.ttf $(OBJDIR)/$(PREFIX)-extralightitalic.ttf $(OBJDIR)/$(PREFIX)-lightitalic.ttf $(OBJDIR)/$(PREFIX)-italic.ttf $(OBJDIR)/$(PREFIX)-mediumitalic.ttf $(OBJDIR)/$(PREFIX)-bolditalic.ttf $(OBJDIR)/$(PREFIX)-heavyitalic.ttf
OBLIQUE = $(OBJDIR)/$(PREFIX)-thinoblique.ttf $(OBJDIR)/$(PREFIX)-extralightoblique.ttf $(OBJDIR)/$(PREFIX)-lightoblique.ttf $(OBJDIR)/$(PREFIX)-oblique.ttf $(OBJDIR)/$(PREFIX)-mediumoblique.ttf $(OBJDIR)/$(PREFIX)-boldoblique.ttf $(OBJDIR)/$(PREFIX)-heavyoblique.ttf
TARGETS = $(UPRIGHT) $(ITALIC) $(OBLIQUE)
MAPS = $(if $(NOCHARMAP),,$(OBJDIR)/$(PREFIX)-regular.charmap)
FDTS = $(subst .ttf,.fdt,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
SVG0 = $(subst .ttf,.svg,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))
PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS))
PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS))
DISTTARGETS = $(subst $(OBJDIR)/,$(DISTDIR)/,$(TARGETS))
fonts : $(DISTTARGETS)
svgs : $(SVG0)
# Pass 0 : file construction
OUTPUTS = -o $@
OUTPUT_CM = $(if $(NOCHARMAP),,--charmap $(subst .fdt,.charmap,$(subst $(OBJDIR)/.pass0-,$(OBJDIR)/,$@)))
$(OBJDIR)/.pass0-$(PREFIX)-thin.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-thin s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-extralight.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-extralight s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-light.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-light s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-regular.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-book s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) $(OUTPUT_CM)
$(OBJDIR)/.pass0-$(PREFIX)-medium.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-medium s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-bold.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-bold s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-heavy.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-heavy s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS)
$(OBJDIR)/.pass0-$(PREFIX)-thinitalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-thin s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-extralightitalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-extralight s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-lightitalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-light s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-italic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-book s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-mediumitalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-medium s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-bolditalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-bold s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-heavyitalic.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-heavy s-italic $(STYLE_ITALIC) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-thinoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-thin s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-extralightoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-extralight s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-lightoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-light s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-oblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-book s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-mediumoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-medium s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-boldoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-bold s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(OBJDIR)/.pass0-$(PREFIX)-heavyoblique.fdt : $(SCRIPTS) | $(OBJDIR) $(DISTDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-heavy s-oblique $(STYLE_UPRIGHT) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(SVG0) : $(OBJDIR)/.pass0-%.svg : $(OBJDIR)/.pass0-%.fdt
$(PASS)
$(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.fdt
$(PASS)
# Pass 1 : Outline cleanup and merge features
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass0-%.fdt
@otfccbuild $< -o $@.a.ttf
@$(HINT) $@.a.ttf $@.b.ttf
@otfccdump $@.b.ttf | otfccbuild -O3 -s -o $@
@-rm $@.a.ttf $@.b.ttf
# Pass 2 : add metadata
#$(TARGETS) : $(OBJDIR)/%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(OBJDIR)/.pass0-%.fdt
# @otfccdump $(word 2,$^) | $(NODE) $< $(word 3,$^) | otfccbuild -s -O3 -o $@ --keep-average-char-width $(HINT_SUFFIX)
$(DISTTARGETS) : $(DISTDIR)/%.ttf : $(OBJDIR)/%.ttf
@cp $< $@
# releaseing
ARCHIVEDIR = release-archives
PAGEDIR = pages/assets
PAGESTTF = $(subst $(DISTDIR)/,$(PAGEDIR)/,$(DISTTARGETS))
$(PAGESTTF) : $(PAGEDIR)/%.ttf : $(DISTDIR)/%.ttf
cp $< $@
PAGESWOFF = $(subst .ttf,.woff,$(PAGESTTF))
$(PAGESWOFF) : $(PAGEDIR)/%.woff : $(PAGEDIR)/%.ttf
sfnt2woff $<
PAGESWOFF2 = $(subst .ttf,.woff2,$(PAGESTTF))
$(PAGESWOFF2) : $(PAGEDIR)/%.woff2 : $(PAGEDIR)/%.ttf
woff2_compress $<
PAGESMAPS = $(subst $(OBJDIR)/,$(PAGEDIR)/,$(MAPS))
$(PAGESMAPS) : $(PAGEDIR)/%.charmap : $(OBJDIR)/%.charmap
cp $< $@
WEBFONTDIR = dist/webfonts/assets
WEBFONTSTTF = $(subst $(DISTDIR)/,$(WEBFONTDIR)/,$(DISTTARGETS))
$(WEBFONTSTTF) : $(WEBFONTDIR)/%.ttf : $(DISTDIR)/%.ttf
cp $< $@
WEBFONTSWOFF = $(subst .ttf,.woff,$(WEBFONTSTTF))
$(WEBFONTSWOFF) : $(WEBFONTDIR)/%.woff : $(WEBFONTDIR)/%.ttf
sfnt2woff $<
WEBFONTSWOFF2 = $(subst .ttf,.woff2,$(WEBFONTSTTF))
$(WEBFONTSWOFF2) : $(WEBFONTDIR)/%.woff2 : $(WEBFONTDIR)/%.ttf
woff2_compress $<
WEBFONTCSS = dist/webfonts/$(ARCPREFIXB).css
$(WEBFONTCSS) : webfont-csses/$(ARCPREFIXB).css
cp $< $@
#$(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).tar.bz2 : $(DISTTARGETS)
# cd $(DISTDIR) && tar -cjvf ../$@ $(subst $(DISTDIR)/,,$^)
$(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).zip : $(DISTTARGETS)
cd $(DISTDIR) && 7z a -tzip -mx=9 ../../$@ ./*.ttf
$(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).7z : $(DISTTARGETS)
cd $(DISTDIR) && 7z a -t7z -mmt=on -m0=LZMA:a=1:d=1536m:fb=256 ../../$@ ./*.ttf
#archives : $(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).tar.bz2 $(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).zip
archives : $(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).zip $(ARCHIVEDIR)/$(ARCPREFIX)$(ARCPREFIXB)-$(VERSION).7z
pages : $(PAGESTTF) $(PAGESWOFF) $(PAGESWOFF2) $(PAGESMAPS)
webfonts : $(WEBFONTSTTF) $(WEBFONTSWOFF) $(WEBFONTSWOFF2) $(WEBFONTCSS)
SNAPSHOT_ASSETS = $(subst dist/webfonts/,snapshot/,$(WEBFONTSTTF) $(WEBFONTSWOFF) $(WEBFONTSWOFF2) $(WEBFONTCSS))
$(SNAPSHOT_ASSETS) : snapshot/% : dist/webfonts/%
cp $< $@
snapshot: $(SNAPSHOT_ASSETS)
# testdrive
TESTDIR = testdrive/assets
TESTTTF = $(subst $(DISTDIR)/,$(TESTDIR)/,$(DISTTARGETS))
$(TESTTTF) : $(TESTDIR)/%.ttf : $(DISTDIR)/%.ttf
cp $< $@
TESTMAPS = $(subst $(OBJDIR)/,$(TESTDIR)/,$(MAPS))
$(TESTMAPS) : $(TESTDIR)/%.charmap : $(OBJDIR)/%.charmap
cp $< $@
test : $(TESTTTF) $(TESTMAPS)

View File

@ -1,51 +0,0 @@
import fontforge
import psMat
import math
import sys
source = sys.argv[1]
font = fontforge.open(source)
if len(sys.argv) < 5 or sys.argv[4] != "true":
# Replace accented characters into references
font.selection.select(("ranges", None), ".notdef", "nonmarkingreturn")
font.replaceWithReference()
font.selection.select("braille1", "braille13", "braille12", "braille17", "braille123", "braille127", "braille137", "braille1237")
for i in font.selection:
glyph = font[i]
glyph.unlinkRef()
# Remove overlapped area
font.selection.all()
font.removeOverlap()
for i in font:
glyph = font[i]
if len(glyph.references) > 0 and len(glyph.layers["Fore"]) > 0: # a mixed glyph
glyph.unlinkRef()
glyph.removeOverlap()
for u in range(0x20, 0x7F):
font.selection.select(("unicode", None), u)
for g in font.selection:
font[g].unlinkRef()
font.selection.all()
font.simplify(0.05, ("smoothcurves", "choosehv"), 0.1)
#font.em = 2000
font.selection.all()
font.layers["Fore"].is_quadratic = True
font.transform(psMat.skew(float(sys.argv[3]) / 180 * math.pi))
font.em = 1000
font.selection.all()
font.round()
font.removeOverlap()
font.simplify(0.01)
font.selection.all()
font.removeOverlap()
font.canonicalContours()
font.canonicalStart()
font.generate(sys.argv[2], flags = ("opentype"))

View File

@ -1,22 +0,0 @@
var path = require('path');
var fs = require('fs');
var toml = require('toml');
var argv = require('yargs').argv;
var glyfsource = '';
process.stdin.resume();
process.stdin.on('data', function (buf) { glyfsource += buf.toString(); });
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.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;
process.stdout.write(JSON.stringify(ttf) + '\n');
});