Round width

This commit is contained in:
Belleve Invis 2020-06-06 23:06:23 -07:00
parent f669f56b15
commit 275fc23ba3
3 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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)