Refactor: Use full charset (upper, lower, digits, punct)

This commit is contained in:
2025-11-08 23:01:29 -08:00
parent 84ecd63037
commit e64e7dc7b3

View File

@@ -2,7 +2,7 @@ import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import opentype from "opentype.js";
import { buildGlyph, METRICS } from "../src/glyphs.js";
import { buildGlyph, METRICS, SUPPORTED_CHARS } from "../src/glyphs.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -12,14 +12,6 @@ if (!fs.existsSync(distDir)) fs.mkdirSync(distDir, { recursive: true });
const FAMILY = "Stain";
const STYLE = "Regular";
const charset = [
" ",
"A","B","C","D","E","F","G","H","I","J","K","L","M",
"N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"0","1","2","3","4","5","6","7","8","9",
".",",",":",";","!","?","-","","—","@"
];
function buildNotdef() {
const w = 600;
const p = new opentype.Path();
@@ -55,7 +47,7 @@ function createGlyph(ch) {
function buildFont() {
const glyphs = [buildNotdef()];
charset.forEach(ch => glyphs.push(createGlyph(ch)));
SUPPORTED_CHARS.forEach(ch => glyphs.push(createGlyph(ch)));
const font = new opentype.Font({
familyName: FAMILY,