minor cleanup of code

This commit is contained in:
be5invis 2021-02-25 18:34:29 -08:00
parent 3294813573
commit 7aa74afa93
4 changed files with 22 additions and 5 deletions

View file

@ -7,14 +7,14 @@ const convertOtd = require("./otd-conv/index");
const { buildOtl } = require("../otl/index");
const { assignFontNames } = require("../meta/naming");
const { setFontMetrics } = require("../meta/aesthetics");
const { copyFontMetrics } = require("../meta/aesthetics");
module.exports = function (para) {
const otd = EmptyFont();
const gs = buildGlyphs(para);
assignFontNames(para, gs.metrics, otd);
setFontMetrics(para, gs.metrics, otd);
assignFontNames(para, otd);
copyFontMetrics(gs.fontMetrics, otd);
const otl = buildOtl(para, gs.glyphStore);
otd.GSUB = otl.GSUB;

View file

@ -150,5 +150,5 @@ export all : define [buildGlyphs para recursive recursiveCodes] : begin
foreach [gb : items-of $$Capture$$.$pendingGlyphBlocks$] : gb.resolve
return : object metrics glyphStore
return : object glyphStore fontMetrics

View file

@ -238,6 +238,23 @@ export : define [setFontMetrics para metrics fm] : begin
set fm.OS_2.sCapHeight CAP
set fm.post.italicAngle [Math.round (0 - para.slopeAngle)]
export : define [copyFontMetrics fm1 fm2] : begin
set fm2.OS_2.xAvgCharWidth fm1.OS_2.xAvgCharWidth
set fm2.head.unitsPerEm fm1.head.unitsPerEm
set fm2.hhea.ascender fm1.hhea.ascender
set fm2.OS_2.usWinAscent fm1.OS_2.usWinAscent
set fm2.OS_2.sTypoAscender fm1.OS_2.sTypoAscender
set fm2.hhea.descender fm1.hhea.descender
set fm2.OS_2.usWinDescent fm1.OS_2.usWinDescent
set fm2.OS_2.sTypoDescender fm1.OS_2.sTypoDescender
set fm2.hhea.lineGap fm1.hhea.lineGap
set fm2.OS_2.sTypoLineGap fm1.OS_2.sTypoLineGap
set fm2.OS_2.sxHeight fm1.OS_2.sxHeight
set fm2.OS_2.sCapHeight fm1.OS_2.sCapHeight
set fm2.post.italicAngle fm1.post.italicAngle
export : define [compositeBaseAnchors] : begin
local h {.}

View file

@ -124,7 +124,7 @@ define [getStyleLinkedStyles weight width slope] : begin
export : define [assignFontNames para metrics font] : begin
export : define [assignFontNames para font] : begin
set font.name {}
define family : para.naming.family.trim