Simplify code around metadata

This commit is contained in:
be5invis 2021-04-27 00:45:40 -07:00
parent 5025aa1d7b
commit ca49579e17
15 changed files with 169 additions and 340 deletions

View file

@ -1,22 +1,12 @@
const Metadata = require("./metadata");
const convertGlyphs = require("./glyphs");
const convertName = require("./name");
const { convertGsub, convertGpos, convertGdef } = require("./layout");
module.exports = function (otdRestFont, gs) {
const head = Metadata.convertHead(otdRestFont.head);
const hhea = Metadata.convertHhea(otdRestFont.hhea);
const post = Metadata.convertPost(otdRestFont.post);
const maxp = Metadata.convertMaxp(otdRestFont.maxp);
const os2 = Metadata.convertOs2(otdRestFont.OS_2);
const name = convertName(otdRestFont.name);
module.exports = function (baseFont, otl, gs) {
const { glyphs, cmap } = convertGlyphs(gs);
const gsub = convertGsub(otdRestFont.GSUB, glyphs);
const gpos = convertGpos(otdRestFont.GPOS, glyphs);
const gdef = convertGdef(otdRestFont.GDEF, glyphs);
const gsub = convertGsub(otl.GSUB, glyphs);
const gpos = convertGpos(otl.GPOS, glyphs);
const gdef = convertGdef(otl.GDEF, glyphs);
return { glyphs, head, hhea, post, maxp, os2, name, cmap, gsub, gpos, gdef };
return { ...baseFont, glyphs, cmap, gsub, gpos, gdef };
};