Skip to content

Commit

Permalink
Switch to Noto Sans Korean
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeLonewolf committed Aug 24, 2024
1 parent 03a4367 commit a8c0b52
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
21 changes: 20 additions & 1 deletion fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ loadGoogleFonts(bundleFontStacks, bundleFontFolder);
copyFolderContents(bundleFontFolder, ttfFontFolder);

for (const stack in customFontStacks) {
// Set to track seen unicode codepoints
const seenCodepoints = new Set();

console.log(`Building ${stack}`);
let font;
for (const stackPart in customFontStacks[stack]) {
let stackPartDef = customFontStacks[stack][stackPart];
Expand All @@ -106,14 +110,27 @@ for (const stack in customFontStacks) {
subsetRange[0],
subsetRange[1]
);

// Filter out glyphs that have already been added
const filteredGlyphArray = subsetGlyphArray.filter((codepoint) => {
if (seenCodepoints.has(codepoint)) {
console.log("DUPE");
return false;
} else {
seenCodepoints.add(codepoint);
return true;
}
});

const fontSegment = Font.create(inputFontBuffer, {
type: "ttf",
subset: subsetGlyphArray,
subset: filteredGlyphArray, // Use the filtered array
hinting: true,
compound2simple: true,
inflate: null,
combinePath: false,
});

if (font === undefined) {
font = fontSegment;
font.data.name = {
Expand Down Expand Up @@ -146,6 +163,8 @@ for (const stack in customFontStacks) {
console.log(`Built ${ttfFile}`);
}

console.log(`..done`);

const pbfBuilderFilename = "~/.cargo/bin/build_pbf_glyphs";

async function buildPbf() {
Expand Down
10 changes: 7 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {},
"devDependencies": {
"fonteditor-core": "^2.1.11",
"fonteditor-core": "^2.4.1",
"glob": "^9.2.1",
"google-font-installer": "^1.2.0",
"npm-run-all": "^4.1.5",
Expand Down

0 comments on commit a8c0b52

Please sign in to comment.