From b8cd224b629533651e89cd251e00a158a6a929cf Mon Sep 17 00:00:00 2001 From: Nicolas Lebrun Date: Sat, 18 May 2024 21:08:55 +0200 Subject: [PATCH] some symbols + split currency from punctuation --- demo/src/letters.ts | 2 + src/currency.ts | 90 +++++++++++++++++++++++++ src/index.ts | 13 +++- src/poncuation.ts | 159 +++++++++++++++++++------------------------- 4 files changed, 173 insertions(+), 91 deletions(-) create mode 100644 src/currency.ts diff --git a/demo/src/letters.ts b/demo/src/letters.ts index 64e8952..5d3fb6a 100644 --- a/demo/src/letters.ts +++ b/demo/src/letters.ts @@ -57,4 +57,6 @@ export default [ ..."1234567890", // Punctuation ...'"⁄_-–—,;;:!¡?¿.…··\'‘’‚‹›"“”„«»()[]{}§¶@*/\\&#%†•′″"', + // Currency + ..."₠₡₢₣₤₥₦₧₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽₾₿₨", ]; diff --git a/src/currency.ts b/src/currency.ts new file mode 100644 index 0000000..b99c720 --- /dev/null +++ b/src/currency.ts @@ -0,0 +1,90 @@ +const currency = { + "¢": [ + [ + [0.725, 0.35], + [0.275, 0.35], + [0.275, 0.65], + [0.725, 0.65], + ], + [ + [0.5, 0.2], + [0.5, 0.8], + ], + ], + "£": [ + [ + [0.5, 0.25], + [0.35, 0.25], + [0.35, 0.75], + [0.25, 0.75], + [0.25, 0.65], + [0.725, 0.65], + ], + [ + [0.25, 0.45], + [0.65, 0.45], + ], + ], + "¤": [ + [ + [0.4, 0.4], + [0.6, 0.4], + [0.6, 0.55], + [0.4, 0.55], + [0.4, 0.4], + ], + [ + [0.6, 0.4], + [0.65, 0.35], + ], + [ + [0.6, 0.55], + [0.65, 0.6], + ], + [ + [0.4, 0.55], + [0.35, 0.6], + ], + [ + [0.4, 0.4], + [0.35, 0.35], + ], + ], + "¥": [ + [ + [0.25, 0.2], + [0.5, 0.5], + [0.75, 0.2], + ], + [ + [0.5, 0.5], + [0.5, 0.7], + ], + [ + [0.25, 0.5], + [0.75, 0.5], + ], + [ + [0.25, 0.6], + [0.75, 0.6], + ], + ], + "€": [ + [ + [0.75, 0.2], + [0.35, 0.2], + [0.35, 0.7], + [0.75, 0.7], + ], + [ + [0.25, 0.4], + [0.55, 0.4], + ], + [ + [0.25, 0.5], + [0.55, 0.5], + ], + ], +}; + +export default currency; diff --git a/src/index.ts b/src/index.ts index 92207ed..f5fe48a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,8 +3,19 @@ import lowercase from "./lowercase/index"; import uppercase from "./uppercase/index"; import ponctuation from "./poncuation"; import number from "./number"; +import currency from "./currency"; -const font = { ...lowercase, ...uppercase, ...ponctuation, ...number } as Font; +/* + * Destructure every glyphs groups and assign glyph key to theirs paths + * font.a = [[[x1, y1], [x2, y2]...]] + */ +const font = { + ...lowercase, + ...uppercase, + ...number, + ...ponctuation, + ...currency, +} as Font; /** * A function to move and scale each glyph vertex/point/Vec coordinate diff --git a/src/poncuation.ts b/src/poncuation.ts index 592088b..71e4949 100644 --- a/src/poncuation.ts +++ b/src/poncuation.ts @@ -5,10 +5,49 @@ const ponctuation = { [0.5, 0.7], ], ], + "…": [ + [ + [0.33, 0.675], + [0.33, 0.7], + ], + [ + [0.5, 0.675], + [0.5, 0.7], + ], + [ + [0.66, 0.675], + [0.66, 0.7], + ], + ], + "·": [ + [ + [0.5, 0.4875], + [0.5, 0.5125], + ], + ], + "·": [ + [ + [0.5, 0.2875], + [0.5, 0.3125], + ], + ], ",": [ [ [0.5, 0.65], - [0.49, 0.69], + [0.5, 0.675], + [0.48, 0.69], + [0.45, 0.7], + ], + ], + ";": [ + [ + [0.5, 0.5], + [0.5, 0.525], + ], + [ + [0.5, 0.65], + [0.5, 0.675], + [0.48, 0.69], [0.45, 0.7], ], ], @@ -20,6 +59,7 @@ const ponctuation = { [ [0.5, 0.65], [0.5, 0.675], + [0.48, 0.69], [0.45, 0.7], ], ], @@ -193,15 +233,27 @@ const ponctuation = { [0.65, 0.45], ], ], + "–": [ + [ + [0.25, 0.45], + [0.75, 0.45], + ], + ], + "—": [ + [ + [0.15, 0.45], + [0.85, 0.45], + ], + ], "×": [ [ [0.325, 0.305], - [0.675, 0.655] + [0.675, 0.655], ], [ [0.675, 0.305], - [0.325, 0.655] - ] + [0.325, 0.655], + ], ], _: [ [ @@ -241,92 +293,6 @@ const ponctuation = { [0.75, 0.4], ], ], - "¢": [ - [ - [0.725, 0.35], - [0.275, 0.35], - [0.275, 0.65], - [0.725, 0.65], - ], - [ - [0.5, 0.2], - [0.5, 0.8], - ], - ], - "£": [ - [ - [0.5, 0.25], - [0.35, 0.25], - [0.35, 0.75], - [0.25, 0.75], - [0.25, 0.65], - [0.725, 0.65], - ], - [ - [0.25, 0.45], - [0.65, 0.45], - ], - ], - "¤": [ - [ - [0.4, 0.4], - [0.6, 0.4], - [0.6, 0.55], - [0.4, 0.55], - [0.4, 0.4], - ], - [ - [0.6, 0.4], - [0.65, 0.35], - ], - [ - [0.6, 0.55], - [0.65, 0.6], - ], - [ - [0.4, 0.55], - [0.35, 0.6], - ], - [ - [0.4, 0.4], - [0.35, 0.35], - ], - ], - "¥": [ - [ - [0.25, 0.2], - [0.5, 0.5], - [0.75, 0.2], - ], - [ - [0.5, 0.5], - [0.5, 0.7], - ], - [ - [0.25, 0.5], - [0.75, 0.5], - ], - [ - [0.25, 0.6], - [0.75, 0.6], - ], - ], - "€": [ - [ - [0.75, 0.2], - [0.35, 0.2], - [0.35, 0.7], - [0.75, 0.7], - ], - [ - [0.25, 0.4], - [0.55, 0.4], - ], - [ - [0.25, 0.5], - [0.55, 0.5], - ], - ], "¦": [ [ [0.5, 0.2], @@ -511,6 +477,13 @@ const ponctuation = { [0.5, 0.3], ], ], + "‘": [ + [ + [0.5125, 0.2], + [0.4875, 0.3], + ], + ], + //"’": [], "«": [ [ [0.5, 0.3], @@ -581,6 +554,12 @@ const ponctuation = { [0.5775, 0.3], ], ], + "⁄": [ + [ + [0.6, 0.35], + [0.3, 0.65], + ], + ], "¼": [ [ [0.6, 0.35],