mirror of
https://github.com/multipleof4/stain.otf.git
synced 2026-01-13 16:17:55 +00:00
Refactor: Use full charset (upper, lower, digits, punct)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user