From 8a37a12411a70a9ea36361b6a368d00179dd3a84 Mon Sep 17 00:00:00 2001 From: be5invis Date: Tue, 3 May 2016 00:26:04 +0800 Subject: [PATCH] optimize padding code --- buildglyphs.ptl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/buildglyphs.ptl b/buildglyphs.ptl index 66bd184..76509e4 100644 --- a/buildglyphs.ptl +++ b/buildglyphs.ptl @@ -512,14 +512,15 @@ export as build : define [buildFont para recursive recursiveCodes] : begin # 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 + local bottomPad : fallback para.linegap 0 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.descender (DESCENDER - para.linegap) - set font.OS_2.usWinDescent ([Math.abs desc] + para.liengap) - set font.OS_2.sTypoDescender (desc - para.liengap) + set font.hhea.descender (DESCENDER - bottomPad) + set font.OS_2.usWinDescent ([Math.abs desc] + bottomPad) + set font.OS_2.sTypoDescender (desc - bottomPad) set font.hhea.lineGap (para.leading - asc + DESCENDER) set font.OS_2.sTypoLineGap (para.leading - asc + desc)