Initial work of ESM transformation
This commit is contained in:
parent
2472c9cff2
commit
b8205a63aa
303 changed files with 1959 additions and 2450 deletions
31
font-src/gen/build-font.mjs
Normal file
31
font-src/gen/build-font.mjs
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { CreateEmptyFont } from "./empty-font.mjs";
|
||||
import { buildGlyphs } from "../glyphs/index.mjs";
|
||||
import { finalizeFont } from "./finalize/index.mjs";
|
||||
import { convertOtd } from "./otd-conv/index.mjs";
|
||||
import * as Caching from "./caching/index.mjs";
|
||||
import { buildOtl } from "../otl/index.mjs";
|
||||
import { assignFontNames } from "../meta/naming.mjs";
|
||||
import { copyFontMetrics } from "../meta/aesthetics.mjs";
|
||||
("use strict");
|
||||
export async function buildFont(argv, para) {
|
||||
const gs = buildGlyphs(para);
|
||||
const baseFont = CreateEmptyFont(argv);
|
||||
assignFontNames(para, baseFont);
|
||||
copyFontMetrics(gs.fontMetrics, baseFont);
|
||||
const otl = buildOtl(para, gs.glyphStore);
|
||||
// Regulate
|
||||
const excludeChars = new Set();
|
||||
if (para.excludedCharRanges) {
|
||||
for (const [start, end] of para.excludedCharRanges) {
|
||||
for (let p = start; p <= end; p++) excludeChars.add(p);
|
||||
}
|
||||
}
|
||||
// Finalize (like geometry conversion)
|
||||
const cache = await Caching.load(argv.iCache, argv.menu.version, argv.cacheFreshAgeKey);
|
||||
const finalGs = finalizeFont(cache, para, gs.glyphStore, excludeChars, otl);
|
||||
if (cache.isUpdated()) {
|
||||
await Caching.save(argv.oCache, argv.menu.version, cache, true);
|
||||
}
|
||||
const font = convertOtd(baseFont, otl, finalGs);
|
||||
return { font, glyphStore: finalGs, cacheUpdated: cache.isUpdated() };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue