Skip to content

Commit

Permalink
and finally... z
Browse files Browse the repository at this point in the history
  • Loading branch information
nclslbrn committed May 10, 2024
1 parent e33295e commit 723441e
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 38 deletions.
27 changes: 15 additions & 12 deletions demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const lowercase = [
..."xẍẋ",
..."yýỳŷẙÿỹẏȳỷỵʏɏƴỿȝ",
..."zźẑžżẓẕƍƶȥʐʑɀʒǯƹƺʓþƿƨƽƅɂʕʡʢʖʗʘʬʭ",
];
],
DEBUG = false;

const rotateGlyph = (g: Glyph) =>
g.map((l: Line) => l.map((p: Vec) => [1 - p[0], 1 - p[1]]));
Expand All @@ -38,13 +39,13 @@ const scaleGlyph = (g: Glyph) =>
g.map((l: Line) =>
l.map((p: Vec) => [0.166 + p[0] * 0.66, 0.166 + p[1] * 0.66]),
);
const mirrorYGlyph = (g: Glyph) =>
g.map((l: Line) => l.map((p: Vec) => [p[0], 1 - p[1]]));
const mirrorXGlyph = (g: Glyph) =>
g.map((l: Line) => l.map((p: Vec) => [p[0], 1 - p[1]]));
const mirrorYGlyph = (g: Glyph) =>
g.map((l: Line) => l.map((p: Vec) => [1 - p[0], p[1]]));

// font["ɜ"] = mirrorYGlyph(font["ɛ"])
// alert(`ʏ: ${JSON.stringify(scaleGlyph(font["Y"]))},`);
// alert(`ʖ: ${JSON.stringify(rotateGlyph(font["ʕ"]))},`);

for (let l = 0; l < lowercase.length; l++) {
if (font[lowercase[l]] === undefined) {
Expand Down Expand Up @@ -99,14 +100,16 @@ const update = () => {
rect.setAttribute("width", `${textSize[0]}`);
rect.setAttribute("height", `${textSize[1]}`);
rect.setAttribute("title", char);
/*
const label = document.createElementNS(namespace, "text");
label.setAttribute("x", `${margin[0] + x * textSize[0] + 10}`);
label.setAttribute("y", `${margin[1] + y * textSize[1] + 20}`);
label.setAttribute("font-size", `${fontScale*20}em`)
label.textContent = char;
group.appendChild(label);
*/

if (DEBUG) {
const label = document.createElementNS(namespace, "text");
label.setAttribute("x", `${margin[0] + x * textSize[0] + 10}`);
label.setAttribute("y", `${margin[1] + y * textSize[1] + 20}`);
label.setAttribute("font-size", `${fontScale*15}em`)
label.textContent = char;
group.appendChild(label);
}

lines.map((d: string) => {
const path = document.createElementNS(namespace, "path");
path.setAttribute("d", d);
Expand Down
Loading

0 comments on commit 723441e

Please sign in to comment.