From 74c3cdf62b63a4cbc5c48ffe6fa65f0e025bd67c Mon Sep 17 00:00:00 2001 From: be5invis Date: Sun, 6 Dec 2015 08:46:50 +0800 Subject: [PATCH] Add options for increasing width. --- parameters.toml | 2 +- pass4-finalize.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/parameters.toml b/parameters.toml index 70168d5..5e0048c 100644 --- a/parameters.toml +++ b/parameters.toml @@ -5,7 +5,7 @@ codename = 'Calibum' copyright = 'Copyright (c) 2015 Belleve Invis.' licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This is licence is avaliable with a FAQ at: http://scripts.sil.org/OFL. This font software is distributes on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence fot the specific language, premissions and limitations governing your use of this font software.''' -width = 500 +width = 500 # Increase this if you think that Iosevka is too narrow cap = 735 xheight = 530 #descender = -205 # Unnecessary diff --git a/pass4-finalize.js b/pass4-finalize.js index 0335c0e..f0839cb 100644 --- a/pass4-finalize.js +++ b/pass4-finalize.js @@ -40,7 +40,11 @@ function writettf(ttf, file){ var ttf = readttf(process.argv[2]); // Fixes xAvgCharWidth -ttf['OS/2'].xAvgCharWidth = ttf.head.unitsPerEm / 2; // 0.5em +var spacewidth = ttf.head.unitsPerEm / 2; +for(var j = 0; j < ttf.glyf.length; j++) if(ttf.glyf[j] && ttf.glyf[j].unicode && ttf.glyf[j].unicode[0] === 0x20) { + spacewidth = ttf.glyf[j].advanceWidth +} +ttf['OS/2'].xAvgCharWidth = spacewidth; // 0.5em ttf['OS/2'].sxHeight = param.iosevka.xheight ttf['OS/2'].sCapHeight = param.iosevka.cap ttf['OS/2'].fsSelection |= (ttf['OS/2'].usWeightClass > 400 ? 1 << 5 : 0) | (ttf.post.italicAngle ? 1 : 0)