Continue ESM transform
This commit is contained in:
parent
b8205a63aa
commit
36835216f5
44 changed files with 1939 additions and 502 deletions
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": ["eslint:recommended", "prettier"],
|
||||
"extends": ["eslint:recommended", "prettier", "plugin:import/recommended"],
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"no-var": "error",
|
||||
|
@ -20,6 +20,17 @@
|
|||
"no-constant-condition": ["error", { "checkLoops": false }],
|
||||
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
|
||||
"no-unused-vars": ["off"],
|
||||
"complexity": ["warn", 16]
|
||||
"complexity": ["warn", 16],
|
||||
|
||||
"import/newline-after-import": ["error", { "count": 1 }],
|
||||
"import/no-unresolved": "off",
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
||||
"newlines-between": "always",
|
||||
"alphabetize": { "order": "asc", "caseInsensitive": true }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { CreateEmptyFont } from "./empty-font.mjs";
|
||||
import { buildGlyphs } from "../glyphs/index.mjs";
|
||||
import { copyFontMetrics } from "../meta/aesthetics.mjs";
|
||||
import { assignFontNames } from "../meta/naming.mjs";
|
||||
import { buildOtl } from "../otl/index.mjs";
|
||||
|
||||
import * as Caching from "./caching/index.mjs";
|
||||
import { CreateEmptyFont } from "./empty-font.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);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import fs from "fs";
|
||||
import zlib from "zlib";
|
||||
|
||||
import { encode, decode } from "@msgpack/msgpack";
|
||||
|
||||
const Edition = 20;
|
||||
|
@ -75,8 +76,13 @@ class Cache {
|
|||
export const load = async function (path, version, freshAgeKey) {
|
||||
let cache = new Cache(freshAgeKey);
|
||||
if (path && fs.existsSync(path)) {
|
||||
const buf = zlib.gunzipSync(await fs.promises.readFile(path));
|
||||
cache.loadRep(version, decode(buf));
|
||||
try {
|
||||
const buf = zlib.gunzipSync(await fs.promises.readFile(path));
|
||||
cache.loadRep(version, decode(buf));
|
||||
} catch (e) {
|
||||
console.error("Error loading cache. Treat as empty.");
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
return cache;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as TypoGeom from "typo-geom";
|
||||
|
||||
import * as CurveUtil from "../../support/geometry/curve-util.mjs";
|
||||
import * as Geom from "../../support/geometry/index.mjs";
|
||||
import { Point } from "../../support/geometry/point.mjs";
|
||||
import { Transform } from "../../support/geometry/transform.mjs";
|
||||
import * as CurveUtil from "../../support/geometry/curve-util.mjs";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function regulateGlyphStore(cache, skew, glyphStore) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { finalizeGlyphs } from "./glyphs.mjs";
|
||||
import { gcFont } from "./gc.mjs";
|
||||
import { Nwid, Wwid } from "../../support/gr.mjs";
|
||||
|
||||
import { gcFont } from "./gc.mjs";
|
||||
import { finalizeGlyphs } from "./glyphs.mjs";
|
||||
|
||||
function assignGrAndCodeRank(glyphStore, ...flatteners) {
|
||||
for (const g of glyphStore.glyphs()) {
|
||||
g.codeRank = 0xffffffff;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Joining, AnyCv, TieMark, Nwid, Wwid } from "../../support/gr.mjs";
|
||||
|
||||
const ApplePostNames = new Map([
|
||||
/* spell-checker: disable */
|
||||
[0xd, "nonmarkingreturn"],
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import { Ot } from "ot-builder";
|
||||
|
||||
import { Point } from "../../support/geometry/point.mjs";
|
||||
import * as Gr from "../../support/gr.mjs";
|
||||
|
||||
import { byCode, bySpacing, byGr, byBuildOrder } from "./glyph-name.mjs";
|
||||
|
||||
function byRank([gna, a], [gnb, b]) {
|
||||
return (
|
||||
b.glyphRank - a.glyphRank ||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { convertGlyphs } from "./glyphs.mjs";
|
||||
import { convertGsub, convertGpos, convertGdef } from "./layout.mjs";
|
||||
|
||||
export function convertOtd(baseFont, otl, gs) {
|
||||
const { glyphs, cmap } = convertGlyphs(gs);
|
||||
const gsub = convertGsub(otl.GSUB, glyphs);
|
||||
|
|
|
@ -1,338 +1,310 @@
|
|||
import { Ot } from "ot-builder";
|
||||
|
||||
class LookupStore {
|
||||
constructor(handlers, glyphs) {
|
||||
this.glyphs = glyphs;
|
||||
this.m_handlers = handlers;
|
||||
this.m_mapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return Array.from(this.m_mapping.values());
|
||||
}
|
||||
query(id) {
|
||||
return this.m_mapping.get(id);
|
||||
}
|
||||
declare(id, otdLookup) {
|
||||
if (this.m_mapping.has(id))
|
||||
return;
|
||||
const handler = this.m_handlers[otdLookup.type];
|
||||
if (!handler)
|
||||
return;
|
||||
this.m_mapping.set(id, handler.init());
|
||||
}
|
||||
fill(id, otdLookup) {
|
||||
const dst = this.query(id);
|
||||
const handler = this.m_handlers[otdLookup.type];
|
||||
if (!dst || !handler)
|
||||
return;
|
||||
if (otdLookup.subtables)
|
||||
throw new Error("Unreachable.");
|
||||
handler.fill(dst, otdLookup, this);
|
||||
}
|
||||
constructor(handlers, glyphs) {
|
||||
this.glyphs = glyphs;
|
||||
this.m_handlers = handlers;
|
||||
this.m_mapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return Array.from(this.m_mapping.values());
|
||||
}
|
||||
query(id) {
|
||||
return this.m_mapping.get(id);
|
||||
}
|
||||
declare(id, otdLookup) {
|
||||
if (this.m_mapping.has(id)) return;
|
||||
const handler = this.m_handlers[otdLookup.type];
|
||||
if (!handler) return;
|
||||
this.m_mapping.set(id, handler.init());
|
||||
}
|
||||
fill(id, otdLookup) {
|
||||
const dst = this.query(id);
|
||||
const handler = this.m_handlers[otdLookup.type];
|
||||
if (!dst || !handler) return;
|
||||
if (otdLookup.subtables) throw new Error("Unreachable.");
|
||||
handler.fill(dst, otdLookup, this);
|
||||
}
|
||||
}
|
||||
const GsubSingleHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.Single();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const k in st) {
|
||||
const from = store.glyphs.queryByName(k);
|
||||
const to = store.glyphs.queryByName(st[k]);
|
||||
if (from && to)
|
||||
dst.mapping.set(from, to);
|
||||
}
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gsub.Single();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const k in st) {
|
||||
const from = store.glyphs.queryByName(k);
|
||||
const to = store.glyphs.queryByName(st[k]);
|
||||
if (from && to) dst.mapping.set(from, to);
|
||||
}
|
||||
}
|
||||
};
|
||||
const GsubMultipleHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.Multiple();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const k in st) {
|
||||
const from = store.glyphs.queryByName(k);
|
||||
const to = mapGlyphListAll(st[k], store);
|
||||
if (!from || !to)
|
||||
continue;
|
||||
dst.mapping.set(from, to);
|
||||
}
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gsub.Multiple();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const k in st) {
|
||||
const from = store.glyphs.queryByName(k);
|
||||
const to = mapGlyphListAll(st[k], store);
|
||||
if (!from || !to) continue;
|
||||
dst.mapping.set(from, to);
|
||||
}
|
||||
}
|
||||
};
|
||||
const GsubAlternateHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.Alternate();
|
||||
},
|
||||
fill: GsubMultipleHandler.fill
|
||||
init() {
|
||||
return new Ot.Gsub.Alternate();
|
||||
},
|
||||
fill: GsubMultipleHandler.fill
|
||||
};
|
||||
const GsubLigatureHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.Ligature();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const { from: _from, to: _to } of st) {
|
||||
const to = store.glyphs.queryByName(_to);
|
||||
const from = mapGlyphListAll(_from, store);
|
||||
if (!from || !to)
|
||||
continue;
|
||||
dst.mapping.push({ from, to });
|
||||
}
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gsub.Ligature();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const st = src.substitutions;
|
||||
for (const { from: _from, to: _to } of st) {
|
||||
const to = store.glyphs.queryByName(_to);
|
||||
const from = mapGlyphListAll(_from, store);
|
||||
if (!from || !to) continue;
|
||||
dst.mapping.push({ from, to });
|
||||
}
|
||||
}
|
||||
};
|
||||
const GsubChainingHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.Chaining();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
out: for (const st of src.rules) {
|
||||
const match = [];
|
||||
for (const m of st.match) {
|
||||
const m1 = mapGlyphListSome(m, store);
|
||||
if (!m1)
|
||||
continue out;
|
||||
match.push(new Set(m1));
|
||||
}
|
||||
const inputBegins = st.inputBegins;
|
||||
const inputEnds = st.inputEnds;
|
||||
const applications = [];
|
||||
for (const ap of st.apply) {
|
||||
const lookup = store.query(ap.lookup);
|
||||
if (!lookup)
|
||||
continue out;
|
||||
applications.push({ at: ap.at - inputBegins, apply: lookup });
|
||||
}
|
||||
dst.rules.push({ match, inputBegins, inputEnds, applications });
|
||||
}
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gsub.Chaining();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
out: for (const st of src.rules) {
|
||||
const match = [];
|
||||
for (const m of st.match) {
|
||||
const m1 = mapGlyphListSome(m, store);
|
||||
if (!m1) continue out;
|
||||
match.push(new Set(m1));
|
||||
}
|
||||
const inputBegins = st.inputBegins;
|
||||
const inputEnds = st.inputEnds;
|
||||
const applications = [];
|
||||
for (const ap of st.apply) {
|
||||
const lookup = store.query(ap.lookup);
|
||||
if (!lookup) continue out;
|
||||
applications.push({ at: ap.at - inputBegins, apply: lookup });
|
||||
}
|
||||
dst.rules.push({ match, inputBegins, inputEnds, applications });
|
||||
}
|
||||
}
|
||||
};
|
||||
const GsubReverseHandler = {
|
||||
init() {
|
||||
return new Ot.Gsub.ReverseSub();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
out: for (const st of src.rules) {
|
||||
const match = [];
|
||||
const doSubAt = st.inputIndex;
|
||||
const replacement = new Map();
|
||||
for (let j = 0; j < st.match.length; j++) {
|
||||
{
|
||||
const m1 = new Set();
|
||||
for (let k = 0; k < st.match[j].length; k++) {
|
||||
const gFrom = store.glyphs.queryByName(st.match[j][k]);
|
||||
if (gFrom)
|
||||
m1.add(gFrom);
|
||||
}
|
||||
if (!m1.size)
|
||||
continue out;
|
||||
match.push(m1);
|
||||
}
|
||||
if (j === doSubAt) {
|
||||
for (let k = 0; k < st.match[j].length; k++) {
|
||||
const gFrom = store.glyphs.queryByName(st.match[j][k]);
|
||||
const gTo = store.glyphs.queryByName(st.to[k]);
|
||||
if (!gFrom)
|
||||
continue;
|
||||
if (gTo) {
|
||||
replacement.set(gFrom, gTo);
|
||||
}
|
||||
else {
|
||||
replacement.set(gFrom, gFrom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dst.rules.push({ match, doSubAt, replacement });
|
||||
}
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gsub.ReverseSub();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
out: for (const st of src.rules) {
|
||||
const match = [];
|
||||
const doSubAt = st.inputIndex;
|
||||
const replacement = new Map();
|
||||
for (let j = 0; j < st.match.length; j++) {
|
||||
{
|
||||
const m1 = new Set();
|
||||
for (let k = 0; k < st.match[j].length; k++) {
|
||||
const gFrom = store.glyphs.queryByName(st.match[j][k]);
|
||||
if (gFrom) m1.add(gFrom);
|
||||
}
|
||||
if (!m1.size) continue out;
|
||||
match.push(m1);
|
||||
}
|
||||
if (j === doSubAt) {
|
||||
for (let k = 0; k < st.match[j].length; k++) {
|
||||
const gFrom = store.glyphs.queryByName(st.match[j][k]);
|
||||
const gTo = store.glyphs.queryByName(st.to[k]);
|
||||
if (!gFrom) continue;
|
||||
if (gTo) {
|
||||
replacement.set(gFrom, gTo);
|
||||
} else {
|
||||
replacement.set(gFrom, gFrom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dst.rules.push({ match, doSubAt, replacement });
|
||||
}
|
||||
}
|
||||
};
|
||||
function mapGlyphListAll(gl, store) {
|
||||
const out = [];
|
||||
for (const item of gl) {
|
||||
const fg = store.glyphs.queryByName(item);
|
||||
if (!fg)
|
||||
return null;
|
||||
out.push(fg);
|
||||
}
|
||||
return out;
|
||||
const out = [];
|
||||
for (const item of gl) {
|
||||
const fg = store.glyphs.queryByName(item);
|
||||
if (!fg) return null;
|
||||
out.push(fg);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function mapGlyphListSome(gl, store) {
|
||||
const out = [];
|
||||
for (const item of gl) {
|
||||
const fg = store.glyphs.queryByName(item);
|
||||
if (!fg)
|
||||
continue;
|
||||
out.push(fg);
|
||||
}
|
||||
if (!out.length)
|
||||
return null;
|
||||
return out;
|
||||
const out = [];
|
||||
for (const item of gl) {
|
||||
const fg = store.glyphs.queryByName(item);
|
||||
if (!fg) continue;
|
||||
out.push(fg);
|
||||
}
|
||||
if (!out.length) return null;
|
||||
return out;
|
||||
}
|
||||
const GsubHandlers = {
|
||||
gsub_single: GsubSingleHandler,
|
||||
gsub_multiple: GsubMultipleHandler,
|
||||
gsub_alternate: GsubAlternateHandler,
|
||||
gsub_ligature: GsubLigatureHandler,
|
||||
gsub_chaining: GsubChainingHandler,
|
||||
gsub_reverse: GsubReverseHandler
|
||||
gsub_single: GsubSingleHandler,
|
||||
gsub_multiple: GsubMultipleHandler,
|
||||
gsub_alternate: GsubAlternateHandler,
|
||||
gsub_ligature: GsubLigatureHandler,
|
||||
gsub_chaining: GsubChainingHandler,
|
||||
gsub_reverse: GsubReverseHandler
|
||||
};
|
||||
const GposMarkToBaseHandler = {
|
||||
init() {
|
||||
return new Ot.Gpos.MarkToBase();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const mm = collectClassMap(src.marks);
|
||||
dst.marks = convertMarkRecords(src.marks, mm, store);
|
||||
dst.bases = convertBaseRecords(src.bases, mm, store);
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gpos.MarkToBase();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const mm = collectClassMap(src.marks);
|
||||
dst.marks = convertMarkRecords(src.marks, mm, store);
|
||||
dst.bases = convertBaseRecords(src.bases, mm, store);
|
||||
}
|
||||
};
|
||||
const GposMarkToMarkHandler = {
|
||||
init() {
|
||||
return new Ot.Gpos.MarkToMark();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const mm = collectClassMap(src.marks);
|
||||
dst.marks = convertMarkRecords(src.marks, mm, store);
|
||||
dst.baseMarks = convertBaseRecords(src.bases, mm, store);
|
||||
}
|
||||
init() {
|
||||
return new Ot.Gpos.MarkToMark();
|
||||
},
|
||||
fill(dst, src, store) {
|
||||
const mm = collectClassMap(src.marks);
|
||||
dst.marks = convertMarkRecords(src.marks, mm, store);
|
||||
dst.baseMarks = convertBaseRecords(src.bases, mm, store);
|
||||
}
|
||||
};
|
||||
function collectClassMap(marks) {
|
||||
let n = 0;
|
||||
const m = new Map();
|
||||
for (const gn in marks) {
|
||||
const mark = marks[gn];
|
||||
if (!m.has(mark.class)) {
|
||||
m.set(mark.class, n);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return m;
|
||||
let n = 0;
|
||||
const m = new Map();
|
||||
for (const gn in marks) {
|
||||
const mark = marks[gn];
|
||||
if (!m.has(mark.class)) {
|
||||
m.set(mark.class, n);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return m;
|
||||
}
|
||||
function convertMarkRecords(marks, mm, store) {
|
||||
const out = new Map();
|
||||
for (const gn in marks) {
|
||||
const mark = marks[gn];
|
||||
const g = store.glyphs.queryByName(gn);
|
||||
if (!g)
|
||||
continue;
|
||||
let markAnchors = [];
|
||||
markAnchors[mm.get(mark.class)] = { x: mark.x, y: mark.y };
|
||||
out.set(g, { markAnchors: markAnchors });
|
||||
}
|
||||
return out;
|
||||
const out = new Map();
|
||||
for (const gn in marks) {
|
||||
const mark = marks[gn];
|
||||
const g = store.glyphs.queryByName(gn);
|
||||
if (!g) continue;
|
||||
let markAnchors = [];
|
||||
markAnchors[mm.get(mark.class)] = { x: mark.x, y: mark.y };
|
||||
out.set(g, { markAnchors: markAnchors });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function convertBaseRecords(bases, mm, store) {
|
||||
const out = new Map();
|
||||
for (const gn in bases) {
|
||||
const baseObj = bases[gn];
|
||||
const g = store.glyphs.queryByName(gn);
|
||||
if (!g)
|
||||
continue;
|
||||
const baseArray = [];
|
||||
for (const bkStr in baseObj) {
|
||||
baseArray[mm.get(bkStr)] = baseObj[bkStr];
|
||||
}
|
||||
out.set(g, { baseAnchors: baseArray });
|
||||
}
|
||||
return out;
|
||||
const out = new Map();
|
||||
for (const gn in bases) {
|
||||
const baseObj = bases[gn];
|
||||
const g = store.glyphs.queryByName(gn);
|
||||
if (!g) continue;
|
||||
const baseArray = [];
|
||||
for (const bkStr in baseObj) {
|
||||
baseArray[mm.get(bkStr)] = baseObj[bkStr];
|
||||
}
|
||||
out.set(g, { baseAnchors: baseArray });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const GposHandlers = {
|
||||
gpos_mark_to_base: GposMarkToBaseHandler,
|
||||
gpos_mark_to_mark: GposMarkToMarkHandler
|
||||
gpos_mark_to_base: GposMarkToBaseHandler,
|
||||
gpos_mark_to_mark: GposMarkToMarkHandler
|
||||
};
|
||||
class FeatureStore {
|
||||
constructor(lookups) {
|
||||
this.lookupStore = lookups;
|
||||
this.m_mapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return Array.from(this.m_mapping.values());
|
||||
}
|
||||
query(id) {
|
||||
return this.m_mapping.get(id);
|
||||
}
|
||||
fill(id, data) {
|
||||
const tag = id.slice(0, 4);
|
||||
const lookups = [];
|
||||
for (const lid of data) {
|
||||
const lookup = this.lookupStore.query(lid);
|
||||
if (lookup)
|
||||
lookups.push(lookup);
|
||||
}
|
||||
this.m_mapping.set(id, { tag, lookups });
|
||||
}
|
||||
constructor(lookups) {
|
||||
this.lookupStore = lookups;
|
||||
this.m_mapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return Array.from(this.m_mapping.values());
|
||||
}
|
||||
query(id) {
|
||||
return this.m_mapping.get(id);
|
||||
}
|
||||
fill(id, data) {
|
||||
const tag = id.slice(0, 4);
|
||||
const lookups = [];
|
||||
for (const lid of data) {
|
||||
const lookup = this.lookupStore.query(lid);
|
||||
if (lookup) lookups.push(lookup);
|
||||
}
|
||||
this.m_mapping.set(id, { tag, lookups });
|
||||
}
|
||||
}
|
||||
class ScriptLanguageStore {
|
||||
constructor(features) {
|
||||
this.featureStore = features;
|
||||
this.m_scriptMapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return this.m_scriptMapping;
|
||||
}
|
||||
fill(id, data) {
|
||||
const scriptTag = id.slice(0, 4);
|
||||
const languageTag = id.slice(5, 9).padEnd(4);
|
||||
let sr = this.m_scriptMapping.get(scriptTag);
|
||||
if (!sr) {
|
||||
sr = { defaultLanguage: null, languages: new Map() };
|
||||
this.m_scriptMapping.set(scriptTag, sr);
|
||||
}
|
||||
const lr = this.createLanguageRecord(data);
|
||||
if (languageTag === "dflt" || languageTag === "DFLT")
|
||||
sr.defaultLanguage = lr;
|
||||
else
|
||||
sr.languages.set(languageTag, lr);
|
||||
}
|
||||
createLanguageRecord(data) {
|
||||
const features = [];
|
||||
for (const fid of data.features) {
|
||||
const feature = this.featureStore.query(fid);
|
||||
if (feature)
|
||||
features.push(feature);
|
||||
}
|
||||
return {
|
||||
requiredFeature: this.featureStore.query(data.requiredFeature) || null,
|
||||
features: features
|
||||
};
|
||||
}
|
||||
constructor(features) {
|
||||
this.featureStore = features;
|
||||
this.m_scriptMapping = new Map();
|
||||
}
|
||||
extract() {
|
||||
return this.m_scriptMapping;
|
||||
}
|
||||
fill(id, data) {
|
||||
const scriptTag = id.slice(0, 4);
|
||||
const languageTag = id.slice(5, 9).padEnd(4);
|
||||
let sr = this.m_scriptMapping.get(scriptTag);
|
||||
if (!sr) {
|
||||
sr = { defaultLanguage: null, languages: new Map() };
|
||||
this.m_scriptMapping.set(scriptTag, sr);
|
||||
}
|
||||
const lr = this.createLanguageRecord(data);
|
||||
if (languageTag === "dflt" || languageTag === "DFLT") sr.defaultLanguage = lr;
|
||||
else sr.languages.set(languageTag, lr);
|
||||
}
|
||||
createLanguageRecord(data) {
|
||||
const features = [];
|
||||
for (const fid of data.features) {
|
||||
const feature = this.featureStore.query(fid);
|
||||
if (feature) features.push(feature);
|
||||
}
|
||||
return {
|
||||
requiredFeature: this.featureStore.query(data.requiredFeature) || null,
|
||||
features: features
|
||||
};
|
||||
}
|
||||
}
|
||||
function ConvertGsubGposT(handlers, T) {
|
||||
return function (table, glyphs) {
|
||||
if (!table)
|
||||
return null;
|
||||
const ls = new LookupStore(handlers, glyphs);
|
||||
if (table.lookups) {
|
||||
if (table.lookupOrder) {
|
||||
for (const l of table.lookupOrder)
|
||||
ls.declare(l, table.lookups[l]);
|
||||
}
|
||||
for (const l in table.lookups)
|
||||
ls.declare(l, table.lookups[l]);
|
||||
for (const l in table.lookups)
|
||||
ls.fill(l, table.lookups[l]);
|
||||
}
|
||||
const fs = new FeatureStore(ls);
|
||||
if (table.features) {
|
||||
for (const f in table.features)
|
||||
fs.fill(f, table.features[f]);
|
||||
}
|
||||
const ss = new ScriptLanguageStore(fs);
|
||||
if (table.languages) {
|
||||
for (const sl in table.languages)
|
||||
ss.fill(sl, table.languages[sl]);
|
||||
}
|
||||
return new T(ss.extract(), fs.extract(), ls.extract());
|
||||
};
|
||||
return function (table, glyphs) {
|
||||
if (!table) return null;
|
||||
const ls = new LookupStore(handlers, glyphs);
|
||||
if (table.lookups) {
|
||||
if (table.lookupOrder) {
|
||||
for (const l of table.lookupOrder) ls.declare(l, table.lookups[l]);
|
||||
}
|
||||
for (const l in table.lookups) ls.declare(l, table.lookups[l]);
|
||||
for (const l in table.lookups) ls.fill(l, table.lookups[l]);
|
||||
}
|
||||
const fs = new FeatureStore(ls);
|
||||
if (table.features) {
|
||||
for (const f in table.features) fs.fill(f, table.features[f]);
|
||||
}
|
||||
const ss = new ScriptLanguageStore(fs);
|
||||
if (table.languages) {
|
||||
for (const sl in table.languages) ss.fill(sl, table.languages[sl]);
|
||||
}
|
||||
return new T(ss.extract(), fs.extract(), ls.extract());
|
||||
};
|
||||
}
|
||||
function convertGdef(otdGdef, glyphs) {
|
||||
const gdef = new Ot.Gdef.Table();
|
||||
gdef.glyphClassDef = new Map();
|
||||
for (const gn in otdGdef.glyphClassDef) {
|
||||
const g = glyphs.queryByName(gn);
|
||||
if (g)
|
||||
gdef.glyphClassDef.set(g, otdGdef.glyphClassDef[gn]);
|
||||
}
|
||||
return gdef;
|
||||
const gdef = new Ot.Gdef.Table();
|
||||
gdef.glyphClassDef = new Map();
|
||||
for (const gn in otdGdef.glyphClassDef) {
|
||||
const g = glyphs.queryByName(gn);
|
||||
if (g) gdef.glyphClassDef.set(g, otdGdef.glyphClassDef[gn]);
|
||||
}
|
||||
return gdef;
|
||||
}
|
||||
export const convertGsub = ConvertGsubGposT(GsubHandlers, Ot.Gsub.Table);
|
||||
export const convertGpos = ConvertGsubGposT(GposHandlers, Ot.Gpos.Table);
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import zlib from "zlib";
|
||||
import * as url from "url";
|
||||
import zlib from "zlib";
|
||||
|
||||
import * as Toml from "@iarna/toml";
|
||||
import { encode } from "@msgpack/msgpack";
|
||||
import { FontIo } from "ot-builder";
|
||||
import * as Toml from "@iarna/toml";
|
||||
|
||||
import { buildFont } from "./gen/build-font.mjs";
|
||||
import * as Parameters from "./support/parameters.mjs";
|
||||
import { applyMetricOverride } from "./support/metric-override.mjs";
|
||||
import * as VariantData from "./support/variant-data.mjs";
|
||||
import { applyLigationData } from "./support/ligation-data.mjs";
|
||||
import { createGrDisplaySheet } from "./support/gr.mjs";
|
||||
import { applyLigationData } from "./support/ligation-data.mjs";
|
||||
import { applyMetricOverride } from "./support/metric-override.mjs";
|
||||
import * as Parameters from "./support/parameters.mjs";
|
||||
import * as VariantData from "./support/variant-data.mjs";
|
||||
|
||||
const __filename = url.fileURLToPath(import.meta.url);
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
import * as TypoGeom from "typo-geom";
|
||||
import { BooleanGeometry, TransformedGeometry } from "../support/geometry/index.mjs";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class BooleImpl {
|
||||
constructor(bindings, operator, operands) {
|
||||
this.bindings = bindings;
|
||||
this.operator = operator;
|
||||
this.operands = operands;
|
||||
}
|
||||
applyToGlyph(glyph) {
|
||||
const operandGeometries = [];
|
||||
const forwardGizmo = glyph.gizmo || this.bindings.GlobalTransform;
|
||||
const backwardGizmo = forwardGizmo.inverse();
|
||||
for (const operand of this.operands) {
|
||||
const g1 = new this.bindings.Glyph();
|
||||
g1.gizmo = forwardGizmo;
|
||||
g1.include(operand);
|
||||
operandGeometries.push(new TransformedGeometry(g1.geometry, backwardGizmo));
|
||||
}
|
||||
return glyph.includeGeometry(
|
||||
new TransformedGeometry(
|
||||
new BooleanGeometry(this.operator, operandGeometries),
|
||||
forwardGizmo
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
export const SetupBuilders = function (bindings) {
|
||||
const union = (...operands) =>
|
||||
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctUnion, operands);
|
||||
const intersection = (...operands) =>
|
||||
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctIntersection, operands);
|
||||
const difference = (...operands) =>
|
||||
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctDifference, operands);
|
||||
return {
|
||||
union: union,
|
||||
intersection: intersection,
|
||||
difference: difference
|
||||
};
|
||||
};
|
|
@ -1,4 +1,5 @@
|
|||
import * as TypoGeom from "typo-geom";
|
||||
|
||||
import { BooleanGeometry, TransformedGeometry } from "../support/geometry/index.mjs";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as CurveUtil from "../support/geometry/curve-util.mjs";
|
||||
import { SpiroGeometry, DiSpiroGeometry } from "../support/geometry/index.mjs";
|
||||
import { BiKnotCollector } from "../support/geometry/spiro-expand.mjs";
|
||||
import { fallback, mix, bez3 } from "../support/utils.mjs";
|
||||
import { SpiroGeometry, DiSpiroGeometry } from "../support/geometry/index.mjs";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class DispiroImpl {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as TypoGeom from "typo-geom";
|
||||
|
||||
import { Point } from "./point.mjs";
|
||||
import { Transform } from "./transform.mjs";
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import crypto from "crypto";
|
||||
import * as TypoGeom from "typo-geom";
|
||||
|
||||
import * as SpiroJs from "spiro";
|
||||
import * as CurveUtil from "./curve-util.mjs";
|
||||
import * as TypoGeom from "typo-geom";
|
||||
|
||||
import * as Format from "../util/formatter.mjs";
|
||||
|
||||
import * as CurveUtil from "./curve-util.mjs";
|
||||
import { Point } from "./point.mjs";
|
||||
import { Transform } from "./transform.mjs";
|
||||
import { SpiroExpander } from "./spiro-expand.mjs";
|
||||
import { Transform } from "./transform.mjs";
|
||||
|
||||
class GeometryBase {
|
||||
asContours() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as SpiroJs from "spiro";
|
||||
import { linreg } from "../utils.mjs";
|
||||
|
||||
import * as Format from "../util/formatter.mjs";
|
||||
import { linreg } from "../utils.mjs";
|
||||
|
||||
class BiKnot {
|
||||
constructor(type, x, y, d1, d2) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Transform } from "../geometry/transform.mjs";
|
||||
import { Point } from "../geometry/point.mjs";
|
||||
import { Anchor } from "../geometry/anchor.mjs";
|
||||
import * as Geom from "../geometry/index.mjs";
|
||||
import { Point } from "../geometry/point.mjs";
|
||||
import { Transform } from "../geometry/transform.mjs";
|
||||
|
||||
export class Glyph {
|
||||
constructor(_identifier) {
|
||||
|
|
1415
package-lock.json
generated
1415
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@
|
|||
"cldr": "^7.2.0",
|
||||
"eslint": "^8.18.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"patel": "^0.38.0",
|
||||
"prettier": "^2.7.1",
|
||||
"verda": "^1.10.0",
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { parseVariantsData } from "../export-data/variants-data.mjs";
|
||||
import * as url from "url";
|
||||
|
||||
import { parseLigationData } from "../export-data/ligation-data.mjs";
|
||||
import { getCharMapAndSupportedLanguageList } from "../export-data/supported-languages.mjs";
|
||||
import { parseVariantsData } from "../export-data/variants-data.mjs";
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
async function processSsOt(dirs) {
|
||||
const variantsData = await parseVariantsData();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import ucdNames from "@unicode/unicode-14.0.0/Names";
|
||||
import ucdNames from "@unicode/unicode-14.0.0/Names/index.js";
|
||||
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const lch = parseInt(process.argv[i], 16);
|
||||
const name = ucdNames.get(lch);
|
||||
console.log(" -", name, `(\`U+${lch.toString(16).toUpperCase().padStart(4, "0")}\`);`);
|
||||
const lch = parseInt(process.argv[i], 16);
|
||||
const name = ucdNames.get(lch);
|
||||
console.log(" -", name, `(\`U+${lch.toString(16).toUpperCase().padStart(4, "0")}\`);`);
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
import fs from "fs";
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
|
||||
function hashFile(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sum = crypto.createHash("sha256");
|
||||
let fileStream = fs.createReadStream(path);
|
||||
fileStream.on("error", err => {
|
||||
return reject(err);
|
||||
});
|
||||
fileStream.on("data", chunk => {
|
||||
try {
|
||||
sum.update(chunk);
|
||||
}
|
||||
catch (ex) {
|
||||
return reject(ex);
|
||||
}
|
||||
});
|
||||
fileStream.on("end", () => {
|
||||
return resolve(sum.digest("hex"));
|
||||
});
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
let sum = crypto.createHash("sha256");
|
||||
let fileStream = fs.createReadStream(path);
|
||||
fileStream.on("error", err => {
|
||||
return reject(err);
|
||||
});
|
||||
fileStream.on("data", chunk => {
|
||||
try {
|
||||
sum.update(chunk);
|
||||
} catch (ex) {
|
||||
return reject(ex);
|
||||
}
|
||||
});
|
||||
fileStream.on("end", () => {
|
||||
return resolve(sum.digest("hex"));
|
||||
});
|
||||
});
|
||||
}
|
||||
export default (async function (out, archiveFiles) {
|
||||
let s = "";
|
||||
for (const file of archiveFiles) {
|
||||
s += `${file.base}\t${await hashFile(file.full)}\n`;
|
||||
}
|
||||
await fs.promises.writeFile(out, s);
|
||||
let s = "";
|
||||
for (const file of archiveFiles) {
|
||||
s += `${file.base}\t${await hashFile(file.full)}\n`;
|
||||
}
|
||||
await fs.promises.writeFile(out, s);
|
||||
});
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
import UnicodeDataIndex from "@unicode/unicode-14.0.0";
|
||||
const BlockData = [
|
||||
[[0xe0a0, 0xe0df], "Private Use Area — Powerline"],
|
||||
[[0xee00, 0xee3f], "Private Use Area — Progress Bar"],
|
||||
// Missing ranges in UnicodeDataIndex
|
||||
[[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "],
|
||||
[[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"]
|
||||
];
|
||||
for (const id of UnicodeDataIndex.Block) {
|
||||
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id))
|
||||
continue;
|
||||
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]);
|
||||
|
||||
export async function collectBlockData() {
|
||||
const BlockData = [
|
||||
[[0xe0a0, 0xe0df], "Private Use Area — Powerline"],
|
||||
[[0xee00, 0xee3f], "Private Use Area — Progress Bar"],
|
||||
// Missing ranges in UnicodeDataIndex
|
||||
[[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "],
|
||||
[[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"]
|
||||
];
|
||||
|
||||
for (const id of UnicodeDataIndex.Block) {
|
||||
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id)) continue;
|
||||
const rangesModule = await import(`@unicode/unicode-14.0.0/Block/${id}/ranges.js`);
|
||||
const rg = rangesModule.default;
|
||||
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]);
|
||||
}
|
||||
BlockData.sort((a, b) => a[0][0] - b[0][0]);
|
||||
return BlockData;
|
||||
}
|
||||
BlockData.sort((a, b) => a[0][0] - b[0][0]);
|
||||
export { BlockData };
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { BlockData } from "./block-data.mjs";
|
||||
import ucdNames from "@unicode/unicode-14.0.0/Names";
|
||||
import ugc from "@unicode/unicode-14.0.0/General_Category";
|
||||
import ugc from "@unicode/unicode-14.0.0/General_Category/index.js";
|
||||
import ucdNames from "@unicode/unicode-14.0.0/Names/index.js";
|
||||
|
||||
import { collectBlockData } from "./block-data.mjs";
|
||||
|
||||
function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
|
||||
let lchFirst = 0,
|
||||
lchLast = 0;
|
||||
|
@ -18,9 +20,9 @@ function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
|
|||
const lchEnd = ((lchLast >>> 4) << 4) + 0x10;
|
||||
return [lchStart, lchEnd];
|
||||
}
|
||||
export const gatherCoverageData = function (covUpright, covItalic, covOblique) {
|
||||
export async function gatherCoverageData(covUpright, covItalic, covOblique) {
|
||||
const result = [];
|
||||
for (const [[lchBlockStart, lchBlockEnd], block] of BlockData) {
|
||||
for (const [[lchBlockStart, lchBlockEnd], block] of await collectBlockData()) {
|
||||
let blockResults = [];
|
||||
const [lchStart, lchEnd] = findFirstLastChar(lchBlockStart, lchBlockEnd, covUpright);
|
||||
if (!lchStart || !lchEnd) continue;
|
||||
|
@ -63,4 +65,4 @@ export const gatherCoverageData = function (covUpright, covItalic, covOblique) {
|
|||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
import fs from "fs";
|
||||
import { parseVariantsData } from "./variants-data.mjs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import { parseLigationData } from "./ligation-data.mjs";
|
||||
import { getCharMapAndSupportedLanguageList } from "./supported-languages.mjs";
|
||||
import package$0 from "../../package.json" assert { type: "json" };
|
||||
import { parseVariantsData } from "./variants-data.mjs";
|
||||
|
||||
export default main;
|
||||
async function main(argv) {
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
const packageJson = JSON.parse(
|
||||
await fs.promises.readFile(path.join(__dirname, "../../package.json"))
|
||||
);
|
||||
const version = packageJson.version;
|
||||
|
||||
const version = package$0.version;
|
||||
export default (async function main(argv) {
|
||||
const variantsData = await parseVariantsData();
|
||||
const ligationData = await parseLigationData();
|
||||
const cl = await getCharMapAndSupportedLanguageList(
|
||||
|
@ -32,4 +40,4 @@ export default (async function main(argv) {
|
|||
argv.exportPathCov,
|
||||
JSON.stringify({ version, ...cl }, { spaces: 2 })
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import * as toml from "@iarna/toml";
|
||||
|
||||
const ligationSamples = [
|
||||
|
@ -217,6 +219,7 @@ function buildLigationSet(ligData, getKey) {
|
|||
return ligationSets;
|
||||
}
|
||||
export const parseLigationData = async function () {
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
const ligToml = await fs.promises.readFile(
|
||||
path.join(__dirname, "../../params/ligation-set.toml"),
|
||||
"utf8"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import cldr from "cldr";
|
||||
import fs from "fs";
|
||||
import zlib from "zlib";
|
||||
|
||||
import { decode } from "@msgpack/msgpack";
|
||||
import cldr from "cldr";
|
||||
|
||||
import { gatherCoverageData } from "./coverage-export/gather-coverage-data.mjs";
|
||||
|
||||
// List all the languages that Iosevka supports, but cannot inferred from CLDR data.
|
||||
|
@ -74,11 +76,7 @@ function getRawCoverage(charMap) {
|
|||
for (const u of codes) rawCoverage.set(u, [gn, tv, cv]);
|
||||
return rawCoverage;
|
||||
}
|
||||
export const getCharMapAndSupportedLanguageList = async function (
|
||||
cmpUpright,
|
||||
cmpItalic,
|
||||
cmpOblique
|
||||
) {
|
||||
export async function getCharMapAndSupportedLanguageList(cmpUpright, cmpItalic, cmpOblique) {
|
||||
const charMap = await readMpCharMap(cmpUpright);
|
||||
const charMapItalic = await readMpCharMap(cmpItalic);
|
||||
const charMapOblique = await readMpCharMap(cmpOblique);
|
||||
|
@ -90,7 +88,11 @@ export const getCharMapAndSupportedLanguageList = async function (
|
|||
glyphCount: charMap.length,
|
||||
codePointCount: rawCoverage.size
|
||||
},
|
||||
unicodeCoverage: gatherCoverageData(rawCoverage, rawCoverageItalic, rawCoverageOblique),
|
||||
unicodeCoverage: await gatherCoverageData(
|
||||
rawCoverage,
|
||||
rawCoverageItalic,
|
||||
rawCoverageOblique
|
||||
),
|
||||
languages: Array.from(getSupportedLanguageSet(rawCoverage)).sort()
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import * as toml from "@iarna/toml";
|
||||
|
||||
import * as VariantDataParser from "../../font-src/support/variant-data.mjs";
|
||||
|
||||
function getCvData(parsed) {
|
||||
|
@ -138,6 +141,7 @@ function uniqueHotChars(cfgDefault, cfgSS) {
|
|||
return Array.from(s);
|
||||
}
|
||||
export const parseVariantsData = async function () {
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
const variantsToml = await fs.promises.readFile(
|
||||
path.join(__dirname, "../../params/variants.toml"),
|
||||
"utf8"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import semver from "semver";
|
||||
|
||||
import { Output } from "./shared/index.mjs";
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
const ChangeFileDir = path.join(__dirname, "../../changes");
|
||||
const ModifiedSinceVersion = "2.x";
|
||||
async function GenerateChangeList(argv, out) {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import { Output } from "./shared/index.mjs";
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copy Markdown
|
||||
async function CopyMarkdown(out, name) {
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as url from "url";
|
||||
|
||||
import SemVer from "semver";
|
||||
|
||||
import { Output } from "./shared/index.mjs";
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
const ChangeFileDir = path.join(__dirname, "../../changes");
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CHANGE LIST
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import { parseLigationData } from "../export-data/ligation-data.mjs";
|
||||
import { parseVariantsData } from "../export-data/variants-data.mjs";
|
||||
|
||||
import Button from "./templates/button.mjs";
|
||||
import CharVariant from "./templates/character-variant.mjs";
|
||||
import GrandTitle from "./templates/grand-title.mjs";
|
||||
import Languages from "./templates/languages.mjs";
|
||||
import Weights from "./templates/weights.mjs";
|
||||
import LigationSet from "./templates/ligation-set.mjs";
|
||||
import Matrix from "./templates/matrix.mjs";
|
||||
import StylisticSet from "./templates/stylistic-set.mjs";
|
||||
import CharVariant from "./templates/character-variant.mjs";
|
||||
import LigationSet from "./templates/ligation-set.mjs";
|
||||
import { parseVariantsData } from "../export-data/variants-data.mjs";
|
||||
import { parseLigationData } from "../export-data/ligation-data.mjs";
|
||||
import Weights from "./templates/weights.mjs";
|
||||
|
||||
class Generator {
|
||||
constructor(outputDir, fontFiles) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const EM = 16;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const unitWidth = 128;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const EM = 240;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
// prettier-ignore
|
||||
const languages = [
|
||||
{ lang: 'English', sample: 'Shaw, those twelve beige hooks are joined if I patch a young, gooey mouth.' },
|
||||
|
@ -26,6 +27,7 @@ const languages = [
|
|||
{ lang: 'Turkish', sample: 'Pijamalı hasta yağız şoföre çabucak güvendi.' },
|
||||
{ lang: 'Ukrainian', sample: 'Чуєш їх, доцю, га? Кумедна ж ти, прощайся без ґольфів!' }
|
||||
];
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const EM = 24;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
function* makeSample(theme, args) {
|
||||
const groupSet = new Set(args.ligSets);
|
||||
for (const row of args.ligationSamples) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const EM = 48;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
const ssStrings = [
|
||||
["ABC.DEF.GHI.JKL.MNO.PQRS.TUV.WXYZ", "abc.def.ghi.jkl.mno.pqrs.tuv.wxyz"],
|
||||
["¢ ſß ΓΛΔ αδιλμξ КУЗЯЖэльфязычникж", "float il1[]={1-2/3.4,5+6=7/8%90};"],
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as themes from "../themes/index.mjs";
|
||||
|
||||
export default (function (args) {
|
||||
const theme = themes[args.theme];
|
||||
const EM = 48;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
export const light = {
|
||||
body: "#20242E",
|
||||
dimmed: "#20242E40",
|
||||
stress: "#048FBF",
|
||||
title: "#8757AD"
|
||||
body: "#20242E",
|
||||
dimmed: "#20242E40",
|
||||
stress: "#048FBF",
|
||||
title: "#8757AD"
|
||||
};
|
||||
export const dark = {
|
||||
body: "#DEE4E3",
|
||||
dimmed: "#DEE4E340",
|
||||
stress: "#03AEE9",
|
||||
title: "#B77FDB"
|
||||
body: "#DEE4E3",
|
||||
dimmed: "#DEE4E340",
|
||||
stress: "#03AEE9",
|
||||
title: "#B77FDB"
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import fs from "fs";
|
||||
|
||||
import * as wawoff from "wawoff2";
|
||||
|
||||
export default (async function (from, to) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import semver from "semver";
|
||||
|
||||
const ChangeFileDir = path.join(__dirname, "../../changes");
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import * as FS from "fs";
|
||||
import * as Path from "path";
|
||||
import * as Verda from "verda";
|
||||
import which from "which";
|
||||
|
||||
import * as toml from "@iarna/toml";
|
||||
import semver from "semver";
|
||||
import * as uuid from "uuid";
|
||||
import * as Verda from "verda";
|
||||
import which from "which";
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -922,7 +923,7 @@ phony(`release`, async target => {
|
|||
}
|
||||
const [archiveFiles] = await target.need(goals);
|
||||
// Create hash of packages
|
||||
await target.need(fu`utility/create-sha-file.js`);
|
||||
await target.need(fu`utility/create-sha-file.mjs`);
|
||||
await node("utility/create-sha-file.mjs", "doc/packages-sha.txt", archiveFiles);
|
||||
// Images and release notes
|
||||
await target.need(SampleImages, Pages, AmendReadme, ReleaseNotes, ChangeLog);
|
||||
|
@ -938,12 +939,11 @@ const ScriptsUnder = oracle.make(
|
|||
(target, ext, dir) => FileList({ under: dir, pattern: `**/*.${ext}` })(target)
|
||||
);
|
||||
const UtilScriptFiles = computed("util-script-files", async target => {
|
||||
const [js, ejs, md] = await target.need(
|
||||
const [mjs, md] = await target.need(
|
||||
ScriptsUnder("mjs", "utility"),
|
||||
ScriptsUnder("ejs", "utility"),
|
||||
ScriptsUnder("md", "utility")
|
||||
);
|
||||
return [...js, ...ejs, ...md];
|
||||
return [...mjs, ...md];
|
||||
});
|
||||
const ScriptFiles = computed.group("script-files", async (target, ext) => {
|
||||
const [ss] = await target.need(ScriptsUnder(ext, `font-src`));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue