From 275fc23ba31e9d98da4f44e26445d38009f21e06 Mon Sep 17 00:00:00 2001 From: Belleve Invis Date: Sat, 6 Jun 2020 23:06:23 -0700 Subject: [PATCH] Round width --- gen/build-font.js | 3 ++- meta/aesthetics.ptl | 2 +- meta/naming.ptl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gen/build-font.js b/gen/build-font.js index 641d91f69..1a539d313 100644 --- a/gen/build-font.js +++ b/gen/build-font.js @@ -24,7 +24,8 @@ module.exports = function (para) { // Filtering if (para.forceMonospace && para.spacing == 0) { - gs.glyphList = gs.glyphList.filter(g => !(g.advanceWidth > para.width)); + for (const g of gs.glyphList) g.advanceWidth = Math.round(g.advanceWidth || 0); + gs.glyphList = gs.glyphList.filter(g => !(g.advanceWidth > Math.round(para.width))); } // Regulate diff --git a/meta/aesthetics.ptl b/meta/aesthetics.ptl index 9e8972d0c..21230040b 100644 --- a/meta/aesthetics.ptl +++ b/meta/aesthetics.ptl @@ -9,7 +9,7 @@ export : define [calculateMetrics para] : begin define HalfUPM : UPM / 2 # Key metrics - define Width para.width + define Width : Math.round para.width define SB para.sb define CAP para.cap define XH para.xheight diff --git a/meta/naming.ptl b/meta/naming.ptl index 340498ddf..65e64aab3 100644 --- a/meta/naming.ptl +++ b/meta/naming.ptl @@ -182,7 +182,7 @@ export : define [assignFontNames para metrics font] : begin regular : not : not ([not isBold] && [not isItalic] && [not isOblique]) useTypoMetrics true set font.OS_2.sFamilyClass : 8 * 0x100 + 9 - set font.OS_2.xAvgCharWidth para.width + set font.OS_2.xAvgCharWidth : Math.round para.width set font.head.macStyle : object bold : not : not isBold italic : not : not (isItalic || isOblique)