Skip to content

Commit

Permalink
Round width
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Jun 7, 2020
1 parent f669f56 commit 275fc23
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gen/build-font.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meta/aesthetics.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meta/naming.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 275fc23

Please sign in to comment.