diff --git a/src/index.ts b/src/index.ts index 66f8600..d8c2d47 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,19 +1,19 @@ import { type Vec, Line, Glyph, Font } from "./type"; import lowercase from "./lowercase/index"; import uppercase from "./uppercase/index"; -import ponctuation from "./punctuation"; +import punctuation from "./punctuation"; import number from "./number"; import currency from "./currency"; /* - * Destructure every glyphs groups and assign glyph key to theirs paths - * font.a = [[[x1, y1], [x2, y2]...]] + * Destructure every glyphs groups to compose the font + * To go deeper on the font sructure please refer to type.d.ts */ const font = { ...lowercase, ...uppercase, ...number, - ...ponctuation, + ...punctuation, ...currency, } as Font; @@ -60,7 +60,7 @@ const getGlyphPath = (key: string, size: Vec, pos: Vec): string[] => { ); } else { console.warn( - `Missing glyph ${key}, You can create it (and add it to this repository by making a pull request) or open an issue.`, + `Missing glyph "${key}" You can create it (and add it to this repository by making a pull request) or open an issue.`, ); return []; } diff --git a/src/punctuation.ts b/src/punctuation.ts index 9d3158c..c979b33 100644 --- a/src/punctuation.ts +++ b/src/punctuation.ts @@ -1,4 +1,4 @@ -import { type Font } from "./type"; +import { type Font } from "./type"; export default { ".": [ @@ -182,11 +182,52 @@ export default { ], [ [0.25, 0.2], - [0.25, 0.225], + [0.35, 0.2], + [0.35, 0.3], + [0.25, 0.3], + [0.25, 0.2], ], [ + [0.65, 0.6], + [0.75, 0.6], [0.75, 0.7], - [0.75, 0.675], + [0.65, 0.7], + [0.65, 0.6], + ], + ], + "†": [ + [ + [0.5, 0.2], + [0.5, 0.7], + ], + [ + [0.3, 0.35], + [0.7, 0.35], + ], + ], + "•": [ + [ + [0.4, 0.35], + [0.6, 0.35], + [0.6, 0.55], + [0.4, 0.55], + [0.4, 0.35], + ], + ], + "′": [ + [ + [0.6, 0.2], + [0.4, 0.35], + ], + ], + "″": [ + [ + [0.5, 0.2], + [0.3, 0.35], + ], + [ + [0.7, 0.2], + [0.5, 0.35], ], ], "|": [ @@ -282,15 +323,15 @@ export default { ], "&": [ [ - [0.75, 0.75], - [0.75, 0.4], - [0.25, 0.4], - [0.25, 0.7], - [0.8, 0.7], + [0.8, 0.75], + [0.8, 0.4], + [0.15, 0.4], + [0.15, 0.7], + [0.85, 0.7], ], [ - [0.35, 0.4], - [0.35, 0.2], + [0.3, 0.4], + [0.3, 0.2], [0.75, 0.2], [0.75, 0.4], ], @@ -500,6 +541,20 @@ export default { [0.45, 0.771], ], ], + "‹": [ + [ + [0.55, 0.35], + [0.4, 0.45], + [0.55, 0.55], + ], + ], + "›": [ + [ + [0.4, 0.35], + [0.55, 0.45], + [0.4, 0.55], + ], + ], "«": [ [ [0.5, 0.3], @@ -524,6 +579,36 @@ export default { [0.5, 0.6], ], ], + "“": [ + [ + [0.44, 0.2], + [0.38, 0.3], + ], + [ + [0.64, 0.2], + [0.58, 0.3], + ], + ], + "”": [ + [ + [0.38, 0.2], + [0.44, 0.3], + ], + [ + [0.58, 0.2], + [0.64, 0.3], + ], + ], + "„": [ + [ + [0.44, 0.7], + [0.38, 0.8], + ], + [ + [0.64, 0.7], + [0.58, 0.3], + ], + ], º: [ [ [0.4125, 0.235], diff --git a/src/type.d.ts b/src/type.d.ts index ba68733..98582c9 100644 --- a/src/type.d.ts +++ b/src/type.d.ts @@ -1,23 +1,23 @@ // A simple 2D vector type export interface Vec extends Array {} -// Another for line (array of Vec) +// A line (array of Vec) export interface Line extends Array {} -// Another for letter (array of Line) +// A glyph/letter (array of Line) export interface Glyph extends Array {} -// An array of diacritics key (two or three letters) -export interface DiaGroup extends Array {} - // Table to dupplicate existing glyph with diacriticals marks +// The key is used to defined a diacriticized letter (à,ê,ï), +// the first item of the array define the base letter w/out diacritics (a, e, i), +// the last item is an array of diacricts name (described in diacritics/glyph.ts) export interface ExtendedTable { [key: string]: [string, string[]]; } // And finally a type for the whole font // where each glyph is defined in an object -// with the char as a key +// with the char as a key { a: [], b: []... } export interface Font { [key: string]: Glyph; }