Skip to content

Commit

Permalink
rearrange glyph
Browse files Browse the repository at this point in the history
  • Loading branch information
nclslbrn committed May 18, 2024
1 parent 52007f3 commit 13e79e3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
37 changes: 19 additions & 18 deletions demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { Glyph, Line, Vec } from "../../src/type";
import letters from "./letters";

const DEBUG = true;

const rotateGlyph = (g: Glyph) =>
g.map((l: Line) => l.map((p: Vec) => [1 - p[0], 1 - p[1]]));
const upscaleGlyph = (g: Glyph) =>
g.map((l: Line) =>
l.map((p: Vec) => [p[0] * 1.33 - 0.166, p[1] * 1.33 - 0.33]),
);

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 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]]));

//
// const rotateGlyph = (g: Glyph) =>
// g.map((l: Line) => l.map((p: Vec) => [1 - p[0], 1 - p[1]]));
// const upscaleGlyph = (g: Glyph) =>
// g.map((l: Line) =>
// l.map((p: Vec) => [p[0] * 1.33 - 0.166, p[1] * 1.33 - 0.33]),
// );
//
// 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 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(upscaleGlyph(font["ɣ"]))},`);

Expand All @@ -41,7 +41,8 @@ const app = document.getElementById("app"),
input = document.createElement("textarea"),
inputSize = document.createElement("input"),
textAtLaunch = "Type text",
glyphKeys = Array.from(Object.keys(font)).join(""),
fontKey = Array.from(Object.keys(font)),
glyphKeys = letters.filter((l) => fontKey.includes(l)).join(""),
group = document.createElementNS(namespace, "g");

const update = () => {
Expand Down
4 changes: 4 additions & 0 deletions demo/src/letters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ export default [
..."XẌẊ",
..."YÝỲŶŸỸẎȲỶỴɎƳỾ",
..."ȜZŹẐŽŻẒẔƵȤⱿƷǮƸÞǷƧƼƄɁ",
// Number
..."1234567890",
// Punctuation
...'"⁄_-–—,;;:!¡?¿.…··\'‘’‚‹›"“”„«»()[]{}§¶@*/\\&#%†•′″"',
];

0 comments on commit 13e79e3

Please sign in to comment.