diff --git a/README.md b/README.md
index 4ec3877..fe37ac8 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Iosevka supports accessing all letter variants using OpenType features.
To build Iosevka you should:
-1. Ensure that [`node`](http://nodejs.org) (≥ 5.0), [`FontForge`](http://fontforge.org) (with Python scripting support, ≥ Aug. 2015 release), [`ttfautohint`](http://www.freetype.org/ttfautohint/), [`ttx`](http://www.adobe.com/cn/devnet/opentype/afdko.html) and `make` are runnable in your terminal.
+1. Ensure that [`node`](http://nodejs.org) (≥ 5.0), [`FontForge`](http://fontforge.org) (with Python scripting support, ≥ Aug. 2015 release), [`ttfautohint`](http://www.freetype.org/ttfautohint/), [`otfcc`](https://github.com/caryll/otfcc) (≥ 0.1.3) 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`.
3. `make`.
diff --git a/buildglyphs.ptl b/buildglyphs.ptl
index 7e9c33f..59f92a2 100644
--- a/buildglyphs.ptl
+++ b/buildglyphs.ptl
@@ -177,7 +177,7 @@ define [fallback] : begin
for [local j 0] (j < arguments.length) [inc j] : if (arguments.(j) !== nothing) : return arguments.(j)
return nothing
-define [TempFont] {.glyf {} .head {.} .hhea {.} ."OS/2" {.} .name {.} .post {.}}
+define [TempFont] {.glyf {} .head {.} .hhea {.} .OS_2 {.panose {}} .name {.} .post {.}}
define [anchorDeriv] : begin
local h {.}
@@ -448,50 +448,72 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
# Font names
set para.family [para.family.trim]
set para.style : [para.style.trim] || "Regular"
- set font.name.preferredFamily para.family
- set font.name.preferredSubFamily para.style
- if (para.style == 'Regular' || para.style == 'Bold' || para.style == 'Italic' || para.style == "Bold Italic") : then
- set font.name.fontFamily para.family
- set font.name.fontSubFamily para.style
- : else
- set font.name.fontFamily : para.family + ' ' + [para.style.replace [regex ' Italic$'] '']
- set font.name.fontSubFamily : if [[regex ' Italic$'].test para.style] 'Italic' 'Regular'
- set font.name.uniqueSubFamily "\(para.family) \(para.style) \(para.version) (\(para.codename))"
- set font.name.version para.version
- set font.name.fullName : if (para.style != 'Regular') (para.family + ' ' + para.style) para.family
- set font.name.postScriptName : font.name.fullName.replace [regex ' ' 'g'] '-'
- set font.name.copyright para.copyright
- set font.name.licence para.licence
+ set font.name {}
+ let : begin
+ define [nameFont nameid str] : begin
+ font.name.push : object # Mac Roman
+ platformID 1
+ encodingID 0
+ languageID 0
+ nameID nameid
+ nameString str
+ font.name.push : object # Windows Unicode English
+ platformID 3
+ encodingID 1
+ languageID 1033
+ nameID nameid
+ nameString str
+
+ nameFont 16 para.family # Preferred Family
+ nameFont 17 para.style # Preferred Style
+ nameFont 21 para.family # WWS Preferred Family
+ nameFont 22 para.style # WWS Preferred Style
+
+ set font.name.preferredFamily para.family
+ set font.name.preferredSubFamily para.style
+ if (para.style == 'Regular' || para.style == 'Bold' || para.style == 'Italic' || para.style == "Bold Italic") : then
+ nameFont 1 para.family # Family
+ nameFont 2 para.style # Style
+ : else
+ nameFont 1 : para.family + ' ' + [para.style.replace [regex ' Italic$'] '']
+ nameFont 2 : if [[regex ' Italic$'].test para.style] 'Italic' 'Regular'
+ nameFont 3 "\(para.family) \(para.style) \(para.version) (\(para.codename))" # Unique Name
+ nameFont 5 para.version # Version
+ local fontfullName : if (para.style != 'Regular') (para.family + ' ' + para.style) para.family
+ nameFont 4 fontfullName # Full Name
+ nameFont 6 : fontfullName.replace [regex ' ' 'g'] '-' # Postscript
+ nameFont 0 para.copyright # Copyright
+ nameFont 14 para.licence # License
# Weight, width and slantness
- set font.'OS/2'.usWeightClass para.weight
- set font.'OS/2'.bProportion 9 # Monospaced
- set font.'OS/2'.bWeight : 1 + para.weight / 100
- set font.'OS/2'.fsSelection : [if para.isBold 32 0] + [if para.isItalic 1 0] + [if ([not para.isBold] && [not para.isItalic]) 64 0] + 128
- set font.'OS/2'.sFamilyClass : 8 * 0x100 + 9
- set font.'OS/2'.xAvgCharWidth WIDTH
- set font.post.isFixedPitch 1
+ set font.OS_2.usWeightClass para.weight
+ set font.OS_2.panose.3 9 # Monospaced
+ set font.OS_2.panose.2 : 1 + para.weight / 100
+ set font.OS_2.fsSelection : [if para.isBold 32 0] + [if para.isItalic 1 0] + [if ([not para.isBold] && [not para.isItalic]) 64 0] + 128
+ set font.OS_2.sFamilyClass : 8 * 0x100 + 9
+ set font.OS_2.xAvgCharWidth WIDTH
+ set font.post.isFixedPitch true
set font.head.macStyle : [if para.isBold 1 0] + [if para.isItalic 2 0]
# Metric metadata
# Note: we use 1000upm in design, and (1000 * upmsacle)upm in production, to avoid rounding error.
let [asc : para.leading * CAP / (CAP - DESCENDER)] [desc : para.leading * DESCENDER / (CAP - DESCENDER)] : begin
- set font.head.unitsPerEm 1000
- set font.hhea.ascent asc
- set font.'OS/2'.usWinAscent asc
- set font.'OS/2'.sTypoAscender asc
+ set font.head.unitsPerEm 1000
+ set font.hhea.ascender asc
+ set font.OS_2.usWinAscent asc
+ set font.OS_2.sTypoAscender asc
- set font.hhea.descent DESCENDER
- set font.'OS/2'.usWinDescent [Math.abs desc]
- set font.'OS/2'.sTypoDescender desc
+ set font.hhea.descender DESCENDER
+ set font.OS_2.usWinDescent [Math.abs desc]
+ set font.OS_2.sTypoDescender desc
- set font.hhea.lineGap (para.leading - asc + DESCENDER)
- set font.'OS/2'.sTypoLineGap (para.leading - asc + desc)
+ set font.hhea.lineGap (para.leading - asc + DESCENDER)
+ set font.OS_2.sTypoLineGap (para.leading - asc + desc)
- set font.'OS/2'.sxHeight XH
- set font.'OS/2'.sCapHeight CAP
- set font.post.italicAngle (0 - para.slantAngle)
+ set font.OS_2.sxHeight XH
+ set font.OS_2.sCapHeight CAP
+ set font.post.italicAngle (0 - para.slantAngle)
# Necessary notdef glyph
sketch # .notdef
diff --git a/emptyfont.toml b/emptyfont.toml
index 34be2eb..5f8751e 100644
--- a/emptyfont.toml
+++ b/emptyfont.toml
@@ -24,11 +24,11 @@ yMin = 0
[hhea]
advanceWidthMax = 374
-ascent = 812
+ascender = 812
caretOffset = 0
caretSlopeRise = 1
caretSlopeRun = 0
-descent = -212
+descender = -212
lineGap = 92
metricDataFormat = 0
minLeftSideBearing = 34
@@ -41,18 +41,9 @@ reserved3 = 0
version = 1
xMaxExtent = 306
-["OS/2"]
+["OS_2"]
achVendID = "PfEd"
-bArmStyle = 0
-bContrast = 0
-bFamilyType = 2
-bLetterform = 0
-bMidline = 0
-bProportion = 3
-bSerifStyle = 0
-bStrokeVariation = 0
-bWeight = 6
-bXHeight = 0
+panose = [2, 0, 5, 9, 0, 0, 0, 0, 0, 0]
fsSelection = 192
fsType = 0
sCapHeight = 0
@@ -99,7 +90,7 @@ version = "Version 1.0"
[post]
format = 2
-isFixedPitch = 0
+isFixedPitch = false
italicAngle = 0
maxMemType1 = 1
maxMemType42 = 0
diff --git a/generator.js b/generator.js
index c24b89b..72b7a1d 100644
--- a/generator.js
+++ b/generator.js
@@ -211,7 +211,7 @@ if (argv.svg) (function() {
var skew = (argv.uprightify ? 1 : 0) * Math.tan((font.post.italicAngle || 0) / 180 * Math.PI);
var scale = (argv.upm || 1000) / 1000;
- svg += ''
+ svg += ''
for (var j = 0; j < font.glyf.length; j++) {
var g = font.glyf[j];
diff --git a/glyphs/symbol-geometric.ptl b/glyphs/symbol-geometric.ptl
index 31ed22a..108f789 100644
--- a/glyphs/symbol-geometric.ptl
+++ b/glyphs/symbol-geometric.ptl
@@ -254,14 +254,14 @@ symbol-block 'Geometric'
symbol-block 'Block Shapes'
sketch # fullblock
set-width FULLWIDTH
- start-from 0 font.'OS/2'.usWinAscent
- line-to FULLWIDTH font.'OS/2'.usWinAscent
- line-to FULLWIDTH (-font.'OS/2'.usWinDescent)
- line-to 0 (-font.'OS/2'.usWinDescent)
+ start-from 0 font.OS_2.usWinAscent
+ line-to FULLWIDTH font.OS_2.usWinAscent
+ line-to FULLWIDTH (-font.OS_2.usWinDescent)
+ line-to 0 (-font.OS_2.usWinDescent)
save 'fullblock' 0x2588
define [Shade fn] : glyph-construction
- local top font.'OS/2'.usWinAscent
- local bottom (-font.'OS/2'.usWinDescent)
+ local top font.OS_2.usWinAscent
+ local bottom (-font.OS_2.usWinDescent)
local segx 6
local segy 16
local g : create-glyph : glyph-construction : foreach j [range 0 segx] : foreach k [range 0 segy] : if [fn j k] : begin
@@ -292,35 +292,35 @@ symbol-block 'Block Shapes'
foreach [fill : range 1 8] : begin
sketch # Vertical fill
set-width FULLWIDTH
- start-from 0 [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent (fill / 8)]
- line-to FULLWIDTH [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent (fill / 8)]
- line-to FULLWIDTH (-font.'OS/2'.usWinDescent)
- line-to 0 (-font.'OS/2'.usWinDescent)
+ start-from 0 [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent (fill / 8)]
+ line-to FULLWIDTH [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent (fill / 8)]
+ line-to FULLWIDTH (-font.OS_2.usWinDescent)
+ line-to 0 (-font.OS_2.usWinDescent)
save ('vfill' + fill) (0x2580 + fill)
sketch # Horizontal fill
set-width FULLWIDTH
- start-from 0 font.'OS/2'.usWinAscent
- line-to (FULLWIDTH * fill / 8) font.'OS/2'.usWinAscent
- line-to (FULLWIDTH * fill / 8) (-font.'OS/2'.usWinDescent)
- line-to 0 (-font.'OS/2'.usWinDescent)
+ start-from 0 font.OS_2.usWinAscent
+ line-to (FULLWIDTH * fill / 8) font.OS_2.usWinAscent
+ line-to (FULLWIDTH * fill / 8) (-font.OS_2.usWinDescent)
+ line-to 0 (-font.OS_2.usWinDescent)
save ('hfill' + fill) (0x2590 - fill)
sketch # upHalfblock
set-width FULLWIDTH
- start-from 0 font.'OS/2'.usWinAscent
- line-to FULLWIDTH font.'OS/2'.usWinAscent
- line-to FULLWIDTH [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent 0.5]
- line-to 0 [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent 0.5]
+ start-from 0 font.OS_2.usWinAscent
+ line-to FULLWIDTH font.OS_2.usWinAscent
+ line-to FULLWIDTH [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent 0.5]
+ line-to 0 [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent 0.5]
save 'upHalfblock' 0x2580
sketch # rightHalfBlock
set-width FULLWIDTH
- start-from (FULLWIDTH * 0.5) font.'OS/2'.usWinAscent
- line-to FULLWIDTH font.'OS/2'.usWinAscent
- line-to FULLWIDTH (-font.'OS/2'.usWinDescent)
- line-to (FULLWIDTH * 0.5) (-font.'OS/2'.usWinDescent)
+ start-from (FULLWIDTH * 0.5) font.OS_2.usWinAscent
+ line-to FULLWIDTH font.OS_2.usWinAscent
+ line-to FULLWIDTH (-font.OS_2.usWinDescent)
+ line-to (FULLWIDTH * 0.5) (-font.OS_2.usWinDescent)
save 'rightHalfBlock' 0x2590
### Box drawing glyphs
@@ -329,7 +329,7 @@ symbol-block 'Box-Drawing'
local heavy : Math.max (light * 2) (WIDTH * 0.15)
local width FULLWIDTH
local midx : FULLWIDTH / 2
- local midy : mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent 0.5
+ local midy : mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent 0.5
define [boxdraw unicode u d l r] : sketch
set-width width
@@ -337,8 +337,8 @@ symbol-block 'Box-Drawing'
local stopV : [Math.max l r] / 2
if l : include : HBar 0 (midx + stopH) midy l
if r : include : HBar (midx - stopH) width midy r
- if d : include : VBar midx (-font.'OS/2'.usWinDescent) (midy + stopV) d
- if u : include : VBar midx (midy - stopV) font.'OS/2'.usWinAscent u
+ if d : include : VBar midx (-font.OS_2.usWinDescent) (midy + stopV) d
+ if u : include : VBar midx (midy - stopV) font.OS_2.usWinAscent u
save ('bd' + [unicode.toString 16 :.toUpperCase]) unicode
@@ -355,11 +355,11 @@ symbol-block 'Box-Drawing'
include : HBar (midx + stopH) width (midy + (r - light)) light
if (r > light) : include : HBar (midx + stopH) width (midy - (r - light)) light
if d : begin
- include : VBar (midx + (d - light)) (-font.'OS/2'.usWinDescent) (midy - stopV) light
- if (d > light) : include : VBar (midx - (d - light)) (-font.'OS/2'.usWinDescent) (midy - stopV) light
+ include : VBar (midx + (d - light)) (-font.OS_2.usWinDescent) (midy - stopV) light
+ if (d > light) : include : VBar (midx - (d - light)) (-font.OS_2.usWinDescent) (midy - stopV) light
if u : begin
- include : VBar (midx + (u - light)) (midy + stopV) font.'OS/2'.usWinAscent light
- if (u > light) : include : VBar (midx - (u - light)) (midy + stopV) font.'OS/2'.usWinAscent light
+ include : VBar (midx + (u - light)) (midy + stopV) font.OS_2.usWinAscent light
+ if (u > light) : include : VBar (midx - (u - light)) (midy + stopV) font.OS_2.usWinAscent light
if (stopH > 0 && [not u]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy + capV) light
if (stopH > 0 && [not d]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy - capV) light
if (stopV > 0 && [not l]) : include : VBar (midx - capH) (midy - stopV - light) (midy + stopV + light) light
@@ -451,7 +451,7 @@ symbol-block 'Box-Drawing'
define [vDashed unicode segments weight] : sketch
set-width width
- foreach j [range 0 segments] : include : VBar midx [mix [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent (j / segments)] [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent ((j + 1) / segments)] 0.2] [mix [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent (j / segments)] [mix (-font.'OS/2'.usWinDescent) font.'OS/2'.usWinAscent ((j + 1) / segments)] 0.8] weight
+ foreach j [range 0 segments] : include : VBar midx [mix [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent (j / segments)] [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent ((j + 1) / segments)] 0.2] [mix [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent (j / segments)] [mix (-font.OS_2.usWinDescent) font.OS_2.usWinAscent ((j + 1) / segments)] 0.8] weight
save ('bd' + [unicode.toString 16 :.toUpperCase]) unicode
@@ -473,7 +473,7 @@ symbol-block 'Box-Drawing'
set-width width
include : dispiro
widths.center light
- g4.up.start midx (-font.'OS/2'.usWinDescent) [heading UPWARD]
+ g4.up.start midx (-font.OS_2.usWinDescent) [heading UPWARD]
arcvh
g4.right.end width midy [heading RIGHTWARD]
save 'bd256D' 0x256D
@@ -482,7 +482,7 @@ symbol-block 'Box-Drawing'
set-width width
include : dispiro
widths.center light
- g4.up.start midx (-font.'OS/2'.usWinDescent) [heading UPWARD]
+ g4.up.start midx (-font.OS_2.usWinDescent) [heading UPWARD]
arcvh
g4.left.end 0 midy [heading LEFTWARD]
save 'bd256E' 0x256E
@@ -491,7 +491,7 @@ symbol-block 'Box-Drawing'
set-width width
include : dispiro
widths.center light
- g4.down.start midx font.'OS/2'.usWinAscent [heading DOWNWARD]
+ g4.down.start midx font.OS_2.usWinAscent [heading DOWNWARD]
arcvh
g4.left.end 0 midy [heading LEFTWARD]
save 'bd256F' 0x256F
@@ -500,7 +500,7 @@ symbol-block 'Box-Drawing'
set-width width
include : dispiro
widths.center light
- g4.down.start midx font.'OS/2'.usWinAscent [heading DOWNWARD]
+ g4.down.start midx font.OS_2.usWinAscent [heading DOWNWARD]
arcvh
g4.right.end width midy [heading RIGHTWARD]
save 'bd2570' 0x2570
@@ -509,16 +509,16 @@ symbol-block 'Box-Drawing'
set-width width
include : dispiro
widths.center light
- flat width font.'OS/2'.usWinAscent
- curl 0 (-font.'OS/2'.usWinDescent)
+ flat width font.OS_2.usWinAscent
+ curl 0 (-font.OS_2.usWinDescent)
save 'bd2571' 0x2571
sketch # bd2572
set-width width
include : dispiro
widths.center light
- flat 0 font.'OS/2'.usWinAscent
- curl width (-font.'OS/2'.usWinDescent)
+ flat 0 font.OS_2.usWinAscent
+ curl width (-font.OS_2.usWinDescent)
save 'bd2572' 0x2572
sketch # bd2573
@@ -545,11 +545,11 @@ symbol-block 'Powerline'
save 'branch' 0xE0A0
sketch # pwlTriangleRight
- start-from O font.'OS/2'.usWinAscent
- line-to 0 font.'OS/2'.usWinAscent
- line-to WIDTH [mix font.'OS/2'.usWinAscent (-font.'OS/2'.usWinDescent) 0.5]
- line-to 0 (-font.'OS/2'.usWinDescent)
- line-to O (-font.'OS/2'.usWinDescent)
+ start-from O font.OS_2.usWinAscent
+ line-to 0 font.OS_2.usWinAscent
+ line-to WIDTH [mix font.OS_2.usWinAscent (-font.OS_2.usWinDescent) 0.5]
+ line-to 0 (-font.OS_2.usWinDescent)
+ line-to O (-font.OS_2.usWinDescent)
save 'pwlTriangleRight' 0xE0B0
@@ -557,33 +557,33 @@ symbol-block 'Powerline'
local fine : adviceBlackness 4
include : dispiro
widths.rhs fine
- flat 0 font.'OS/2'.usWinAscent
- curl WIDTH [mix font.'OS/2'.usWinAscent (-font.'OS/2'.usWinDescent) 0.5]
+ flat 0 font.OS_2.usWinAscent
+ curl WIDTH [mix font.OS_2.usWinAscent (-font.OS_2.usWinDescent) 0.5]
include : dispiro
widths.rhs fine
- flat WIDTH [mix font.'OS/2'.usWinAscent (-font.'OS/2'.usWinDescent) 0.5]
- curl 0 (-font.'OS/2'.usWinDescent)
+ flat WIDTH [mix font.OS_2.usWinAscent (-font.OS_2.usWinDescent) 0.5]
+ curl 0 (-font.OS_2.usWinDescent)
save 'pwlAngleRight' 0xE0B1
sketch # pwlTriangleLeft
include glyphs.pwlTriangleRight
- include : FlipAround MIDDLE [mix font.'OS/2'.usWinAscent (-font.'OS/2'.usWinDescent) 0.5]
+ include : FlipAround MIDDLE [mix font.OS_2.usWinAscent (-font.OS_2.usWinDescent) 0.5]
save 'pwlTriangleLeft' 0xE0B2
sketch # pwlAngleLeft
include glyphs.pwlAngleRight
- include : FlipAround MIDDLE [mix font.'OS/2'.usWinAscent (-font.'OS/2'.usWinDescent) 0.5]
+ include : FlipAround MIDDLE [mix font.OS_2.usWinAscent (-font.OS_2.usWinDescent) 0.5]
save 'pwlAngleLeft' 0xE0B3
sketch # pwlUnderline
local fine : adviceBlackness 4
- include : HBarBottom 0 WIDTH (-font.'OS/2'.usWinDescent)
+ include : HBarBottom 0 WIDTH (-font.OS_2.usWinDescent)
save 'pwlUnderline' 0xE0AE
sketch # pwlOverline
local fine : adviceBlackness 4
- include : HBarTop 0 WIDTH font.'OS/2'.usWinAscent
+ include : HBarTop 0 WIDTH font.OS_2.usWinAscent
save 'pwlOverline' 0xE0AF
sketch # pwlLock
diff --git a/glyphs/symbol-other.ptl b/glyphs/symbol-other.ptl
index b9ed6c9..a4a3bc4 100644
--- a/glyphs/symbol-other.ptl
+++ b/glyphs/symbol-other.ptl
@@ -115,7 +115,7 @@ symbol-block 'Musical'
symbol-block 'Metric marks'
sketch # metmark
- include : VBar MIDDLE (-font.'OS/2'.usWinDescent) (font.'OS/2'.usWinAscent) SHOULDERFINE
+ include : VBar MIDDLE (-font.OS_2.usWinDescent) (font.OS_2.usWinAscent) SHOULDERFINE
include : HBar MIDDLE WIDTH 0 SHOULDERFINE
include : HBar MIDDLE WIDTH CAP SHOULDERFINE
include : HBar MIDDLE WIDTH XH SHOULDERFINE
diff --git a/onegroup.mk b/onegroup.mk
index 0d566c9..36eb8fa 100644
--- a/onegroup.mk
+++ b/onegroup.mk
@@ -109,10 +109,7 @@ $(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.svg $(OB
# Pass 2 : add metadata
# IDKY, but converting into TTX and convert back dramatically reduces the file size
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(OBJDIR)/.pass0-%.fdt
- @$(NODE) $^ -o $@.a.ttf
- @ttx -q -o $@.a.ttx $@.a.ttf
- @ttx -q -o $@ $@.a.ttx
- @-rm $@.a.ttf $@.a.ttx
+ @otfccdump $(word 2,$^) | $(NODE) $< $(word 3,$^) | otfccbuild -o $@ --ignore-glyph-order --keep-average-char-width --dummy-dsig --short-post
HINT = ttfautohint --increase-x-height=0
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf
diff --git a/pass1-cleanup.py b/pass1-cleanup.py
index b2c7677..abfcb9f 100644
--- a/pass1-cleanup.py
+++ b/pass1-cleanup.py
@@ -8,7 +8,6 @@ font = fontforge.open(source)
font.mergeFeature(sys.argv[2])
font.selection.all()
# Replace accented characters into references
-print " Reference finding: ", font.fontname
font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF)
font.replaceWithReference()
font.selection.all()
@@ -27,7 +26,6 @@ if hasLigation:
font.replaceWithReference()
# Remove overlapped area
-print " Overlap Removal: ", font.fontname
font.selection.all()
font.removeOverlap()
for i in font:
@@ -36,7 +34,6 @@ for i in font:
glyph.unlinkRef()
glyph.removeOverlap()
-print " Simplify: ", font.fontname
font.selection.all()
font.simplify(0.05, ("smoothcurves", "choosehv"), 0.1)
diff --git a/pass2-finalize.js b/pass2-finalize.js
index 69ed1a1..33c8408 100644
--- a/pass2-finalize.js
+++ b/pass2-finalize.js
@@ -1,54 +1,20 @@
var path = require('path');
var fs = require('fs');
-var TTFReader = require('node-sfnt').TTFReader;
-var TTFWriter = require('node-sfnt').TTFWriter;
var toml = require('toml');
var argv = require('yargs').argv;
-var param = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'parameters.toml'), 'utf-8'))
-
-function toArrayBuffer(buffer) {
- var length = buffer.length;
- var view = new DataView(new ArrayBuffer(length), 0, length);
- for (var i = 0, l = length; i < l; i++) {
- view.setUint8(i, buffer[i], false);
- }
- return view.buffer;
-}
-function toBuffer(arrayBuffer) {
- var length = arrayBuffer.byteLength;
- var view = new DataView(arrayBuffer, 0, length);
- var buffer = new Buffer(length);
- for (var i = 0, l = length; i < l; i++) {
- buffer[i] = view.getUint8(i, false);
- }
- return buffer;
-}
-
-var options = { preserveOS2Version: true, preserveXAvgCharWidth: true, writeUnknownTables: true, hinting: true }
-
-function readttf(file) {
- var data = fs.readFileSync(file);
- var buffer = toArrayBuffer(data);
- var ttf = (new TTFReader(options)).read(buffer);
- return ttf;
-}
-
-function writettf(ttf, file) {
- var buffer = new TTFWriter(options).write(ttf);
- fs.writeFileSync(file, toBuffer(buffer));
-}
-
-var glyfsource = readttf(argv._[0]);
-var ttf = JSON.parse(fs.readFileSync(argv._[1], 'utf-8'));
-
-ttf.post.format = 3
-ttf.DSIG = { // add a dummy SDIG
- name: 'DSIG',
- content: [0, 0, 0, 1, 0, 0, 0, 0]
-}
-ttf.glyf = glyfsource.glyf;
-ttf.GDEF = glyfsource.GDEF;
-ttf.GSUB = glyfsource.GSUB;
-ttf.GPOS = glyfsource.GPOS;
-fs.writeFileSync(argv.o, toBuffer(new TTFWriter(options).write(ttf)));
\ No newline at end of file
+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.GDEF = glyfs.GDEF;
+ ttf.GSUB = glyfs.GSUB;
+ ttf.GPOS = glyfs.GPOS;
+ process.stdout.write(JSON.stringify(ttf));
+});
\ No newline at end of file