Skip to content

Commit

Permalink
Release 0.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Jun 3, 2023
2 parents 9f167dc + 3faacd7 commit a09a5a3
Show file tree
Hide file tree
Showing 360 changed files with 49 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"bold": "Bold"
},
"classicalRegion": "cl",
"classicalOverridePrefix":"GenneGothic",
"classicalOverridePrefix":"AdvocateAncientSansTC",
"classicalOverrideSuffix": {
"extralight": "ExtraLight-subset",
"light": "Light-subset",
Expand Down
42 changes: 42 additions & 0 deletions make/helpers/sort-glyphs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Ot } from "ot-builder";

export function sortGlyphs(font) {
const m = new Map();
for (const [id, g] of font.glyphs.decideOrder().entries()) {
m.set(g, new SortGlyphEntry(id === 0 ? 0 : 1, 0xffffff, 0xffffff, g));
}
if (font.cmap) {
for (const [ch, vs, g] of font.cmap.vs.entries()) {
const entry = m.get(g);
if (ch < entry.u || (ch === entry.u && vs < entry.v)) {
entry.u = ch;
entry.v = vs;
}
}
for (const [ch, g] of font.cmap.unicode.entries()) {
const entry = m.get(g);
if (ch <= entry.u) {
entry.u = ch;
entry.v = 0;
}
}
}

const sorted = Array.from(m.values())
.sort((a, b) => a.compare(b))
.map(a => a.g);
font.glyphs = Ot.ListGlyphStoreFactory.createStoreFromList(sorted);
}

class SortGlyphEntry {
constructor(rank, u, v, g) {
this.rank = rank;
this.u = u;
this.v = v;
this.g = g;
}

compare(that) {
return this.rank - that.rank || this.u - that.u || this.v - that.v || 0;
}
}
7 changes: 5 additions & 2 deletions make/kanji/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CliProc, Ot } from "ot-builder";

import { dropCharacters, dropHints, dropOtl } from "../helpers/drop.mjs";
import { readFont, writeFont } from "../helpers/font-io.mjs";
import { sortGlyphs } from "../helpers/sort-glyphs.mjs";
import { isIdeograph } from "../helpers/unicode-kind.mjs";

export default (async function pass(argv) {
Expand All @@ -12,10 +13,12 @@ export default (async function pass(argv) {
dropCharacters(font, c => !isIdeograph(c));

if (argv.classicalOverride) {
const b = await readFont(argv.classicalOverride);
CliProc.mergeFonts(font, b, Ot.ListGlyphStoreFactory, { preferOverride: true });
const override = await readFont(argv.classicalOverride);
dropCharacters(override, c => !isIdeograph(c));
CliProc.mergeFonts(font, override, Ot.ListGlyphStoreFactory, { preferOverride: true });
}

CliProc.gcFont(font, Ot.ListGlyphStoreFactory);
sortGlyphs(font);
await writeFont(argv.o, font);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sarasa-gothic",
"version": "0.40.7",
"version": "0.41.0",
"main": "./run",
"scripts": {
"build": "verda -f verdafile.mjs",
Expand Down
Loading

0 comments on commit a09a5a3

Please sign in to comment.