mirror of
https://github.com/multipleof4/stain.otf.git
synced 2026-01-14 00:27: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 path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import opentype from "opentype.js";
|
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 __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
@@ -12,14 +12,6 @@ if (!fs.existsSync(distDir)) fs.mkdirSync(distDir, { recursive: true });
|
|||||||
const FAMILY = "Stain";
|
const FAMILY = "Stain";
|
||||||
const STYLE = "Regular";
|
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() {
|
function buildNotdef() {
|
||||||
const w = 600;
|
const w = 600;
|
||||||
const p = new opentype.Path();
|
const p = new opentype.Path();
|
||||||
@@ -55,7 +47,7 @@ function createGlyph(ch) {
|
|||||||
|
|
||||||
function buildFont() {
|
function buildFont() {
|
||||||
const glyphs = [buildNotdef()];
|
const glyphs = [buildNotdef()];
|
||||||
charset.forEach(ch => glyphs.push(createGlyph(ch)));
|
SUPPORTED_CHARS.forEach(ch => glyphs.push(createGlyph(ch)));
|
||||||
|
|
||||||
const font = new opentype.Font({
|
const font = new opentype.Font({
|
||||||
familyName: FAMILY,
|
familyName: FAMILY,
|
||||||
|
|||||||
Reference in New Issue
Block a user