From 7dd3c54757a4a38a010ed38f0d0126c331bcef78 Mon Sep 17 00:00:00 2001 From: Nicolas Lebrun Date: Mon, 6 May 2024 21:40:55 +0200 Subject: [PATCH] m n o --- demo/index.html | 2 +- demo/src/index.ts | 20 ++-- src/glyphs/diacritics.ts | 31 ++--- src/glyphs/lowercase/base.ts | 130 +++++++++++++++++++-- src/glyphs/lowercase/diaBaseAssociation.ts | 52 ++++++++- src/glyphs/lowercase/index.ts | 8 ++ 6 files changed, 204 insertions(+), 39 deletions(-) diff --git a/demo/index.html b/demo/index.html index dad9067..7266f17 100644 --- a/demo/index.html +++ b/demo/index.html @@ -23,7 +23,7 @@
diff --git a/demo/src/index.ts b/demo/src/index.ts index 1e0b25e..bd30e71 100644 --- a/demo/src/index.ts +++ b/demo/src/index.ts @@ -37,7 +37,7 @@ console.log( ), ); */ -/* + const rotateGlyph = (g: Glyph) => g.map((l: Line) => l.map((p: Vec) => [1 - p[0], 1 - p[1]])); const upscaleGlyph = (g: Glyph) => @@ -45,14 +45,14 @@ const upscaleGlyph = (g: Glyph) => 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) => [p[0], 1 - p[1]])); +const mirrorXGlyph = (g: Glyph) => g.map((l: Line) => l.map((p: Vec) => [1 - p[0], p[1]])); // font["ɜ"] = mirrorYGlyph(font["ɛ"]) -console.log(JSON.stringify(scaleGlyph(font["L"]))); -*/ +// alert(`ɴ: ${JSON.stringify(scaleGlyph(font["N"]))},`); + for (let l = 0; l < lowercase.length; l++) { if (font[lowercase[l]] === undefined) { console.log(`%c ${lowercase[l]}`, "font-size: 3em"); @@ -83,7 +83,7 @@ const update = () => { Math.min(Math.floor(Math.hypot(width, height) * fontScale), 264), ), textSize = [baseSize, baseSize], - charPerLine = Math.floor(width / textSize[0]) - 2, + charPerLine = Math.floor(width / textSize[0]), nbLines = Math.ceil(text.length / charPerLine), margin = [(width - charPerLine * textSize[0]) / 2, 40]; group.textContent = ""; @@ -138,13 +138,15 @@ const init = () => { input.innerText = textAtLaunch; input.addEventListener("change", update); - inputSize.type = "range"; inputSize.min = "0.05"; - inputSize.value = "0.17"; inputSize.max = "0.2"; inputSize.step = "0.01"; - inputSize.addEventListener("change", update); + inputSize.value = "0.12"; + inputSize.addEventListener("change", (e) => { + console.log((e.target as HTMLInputElement).value); + update(); + }); form.appendChild(input); form.appendChild(inputSize); diff --git a/src/glyphs/diacritics.ts b/src/glyphs/diacritics.ts index 15e0017..6ad96a7 100644 --- a/src/glyphs/diacritics.ts +++ b/src/glyphs/diacritics.ts @@ -38,11 +38,11 @@ const diacritics = { dr: [ [ [0.4, 0.1], - [0.4, 0.15], + [0.4, 0.125], ], [ [0.6, 0.1], - [0.6, 0.15], + [0.6, 0.125], ], ], // tild @@ -157,21 +157,15 @@ const diacritics = { // ring/dot below db: [ [ - [0.5, 0.75], - [0.55, 0.8], - [0.5, 0.85], - [0.45, 0.8], - [0.5, 0.75], + [0.5, 0.8], + [0.5, 0.825] ], ], // dot above da: [ [ - [0.5, 0.05], - [0.55, 0.1], - [0.5, 0.15], - [0.45, 0.1], - [0.5, 0.05], + [0.5, 0.1], + [0.5, 0.125] ], ], // hook above @@ -187,9 +181,9 @@ const diacritics = { // hook bottom right hbr: [ [ - [0.85, 0.725], + [0.85, 0.7], [0.85, 0.85], - [0.9, 0.9] + [0.75, 0.9] ] ], // line below @@ -229,6 +223,15 @@ const diacritics = { [0.75, 0.75], [0.85, 0.8] ] + ], + // ogonek middle + gnkc: [ + [ + [0.5, 0.7], + [0.475, 0.75], + [0.5, 0.79], + [0.55, 0.8] + ] ] } as Font; diff --git a/src/glyphs/lowercase/base.ts b/src/glyphs/lowercase/base.ts index 9a20ff3..d844bba 100644 --- a/src/glyphs/lowercase/base.ts +++ b/src/glyphs/lowercase/base.ts @@ -326,7 +326,6 @@ const base = { ], ƌ: [ [ - [0.15, 0.15], [0.15, 0.15], [0.85, 0.725], ], @@ -722,7 +721,7 @@ const base = { i: [ [ [0.5, 0.1], - [0.5, 0.15], + [0.5, 0.125], ], [ [0.15, 0.3], @@ -738,7 +737,7 @@ const base = { ij: [ [ [0.35, 0.1], - [0.35, 0.15], + [0.35, 0.125], ], [ [0.15, 0.3], @@ -752,7 +751,7 @@ const base = { ], [ [0.65, 0.1], - [0.65, 0.15], + [0.65, 0.125], ], [ [0.5, 0.3], @@ -793,7 +792,7 @@ const base = { ɨ: [ [ [0.5, 0.1], - [0.5, 0.15], + [0.5, 0.125], ], [ [0.15, 0.3], @@ -823,7 +822,7 @@ const base = { j: [ [ [0.6, 0.1], - [0.6, 0.15], + [0.6, 0.125], ], [ [0.15, 0.3], @@ -849,7 +848,7 @@ const base = { ɉ: [ [ [0.6, 0.1], - [0.6, 0.15], + [0.6, 0.125], ], [ [0.15, 0.3], @@ -868,7 +867,7 @@ const base = { ʝ: [ [ [0.6, 0.1], - [0.6, 0.15], + [0.6, 0.125], ], [ [0.15, 0.3], @@ -1002,7 +1001,7 @@ const base = { [ [0.65, 0.1], - [0.65, 0.15], + [0.65, 0.125], ], [ [0.5, 0.3], @@ -1153,8 +1152,34 @@ const base = { [0.5, 0.8], ], ], + ƛ: [ + [ + [0.3, 0.15], + [0.5, 0.2], + [0.85, 0.7], + ], + [ + [0.62, 0.4], + [0.15, 0.7], + ], + [ + [0.48, 0.35], + [0.65, 0.25], + ], + ], + ʎ: [ + [ + [0.7, 0.15], + [0.5, 0.2], + [0.15, 0.7], + ], + [ + [0.38, 0.4], + [0.85, 0.7], + ], + ], - m: [ + m: [ [ [0.15, 0.7], [0.15, 0.275], @@ -1169,6 +1194,7 @@ const base = { [0.5, 0.7], ], ], + n: [ [ [0.15, 0.7], @@ -1180,6 +1206,90 @@ const base = { [0.85, 0.7], ], ], + nj: [ + [ + [0.15, 0.7], + [0.15, 0.275], + ], + [ + [0.15, 0.3], + [0.45, 0.3], + [0.45, 0.7], + ], + [ + [0.7, 0.1], + [0.7, 0.125], + ], + [ + [0.55, 0.3], + [0.85, 0.3], + ], + [ + [0.7, 0.3], + [0.7, 0.9], + [0.45, 0.9], + ], + ], + ɴ: [ + [ + [0.265, 0.628], + [0.265, 0.3], + [0.73, 0.628], + [0.73, 0.3], + ], + ], + ɲ: [ + [ + [0.1, 0.77], + [0.125, 0.75], + [0.15, 0.7], + [0.15, 0.275], + ], + [ + [0.15, 0.3], + [0.85, 0.3], + [0.85, 0.7], + ], + ], + ƞ: [ + [ + [0.15, 0.7], + [0.15, 0.275], + ], + [ + [0.15, 0.3], + [0.85, 0.3], + [0.85, 0.9], + ], + ], + ɳ: [ + [ + [0.15, 0.7], + [0.15, 0.275], + ], + [ + [0.15, 0.3], + [0.77, 0.3], + [0.77, 0.85], + [0.85, 0.9] + ], + ], + ȵ: [ + [ + [0.15, 0.7], + [0.15, 0.275], + ], + [ + [0.15, 0.3], + [0.65, 0.3], + [0.65, 0.9], + [0.85, 0.9], + [0.85, 0.7], + [0.5, 0.9] + ], + + ], + o: [ [ [0.15, 0.7], diff --git a/src/glyphs/lowercase/diaBaseAssociation.ts b/src/glyphs/lowercase/diaBaseAssociation.ts index 4bdbb60..1455c87 100644 --- a/src/glyphs/lowercase/diaBaseAssociation.ts +++ b/src/glyphs/lowercase/diaBaseAssociation.ts @@ -147,19 +147,61 @@ const diaBaseAssociation = { ḽ: ["l", ["crb"]], ḻ: ["l", ["lb"]], + // m + ḿ: ["m", ["ct"]], + ṁ: ["m", ["da"]], + ṃ: ["m", ["db"]], + ɱ: ["m", ["hbr"]], + + // n + ń: ["n", ["ct"]], + ǹ: ["n", ["gr"]], + ň: ["n", ["hc"]], + ñ: ["n", ["tl"]], + ṅ: ["n", ["da"]], + ņ: ["n", ["cd"]], + ṇ: ["n", ["db"]], + ṋ: ["n", ["crb"]], + ṉ: ["n", ["lb"]], + ŋ: ["n", ["hbr"]], + // o - ọ: ["o", ["db"]], - ỏ: ["o", ["ha"]], + ó: ["o", ["ct"]], + ò: ["o", ["gr"]], + ŏ: ["o", ["br"]], + ô: ["o", ["cr"]], ố: ["o", ["cr", "ct"]], ồ: ["o", ["cr", "gr"]], - ổ: ["o", ["cr", "ha"]], ỗ: ["o", ["cr", "tl"]], - ộ: ["o", ["cr", "db"]], + ổ: ["o", ["cr", "ha"]], + ǒ: ["o", ["hc"]], + ö: ["o", ["dr"]], + ȫ: ["o", ["dr", "mc"]], + ő: ["o", ["ct", "ct"]], + õ: ["o", ["tl"]], + ṍ: ["o", ["tl", "ct"]], + ṏ: ["o", ["tl", "dr"]], + ȭ: ["o", ["tl", "mc"]], + ȯ: ["o", ["da"]], + ȱ: ["o", ["da", "mc"]], + ø: ["o", ["brd"]], + ǿ: ["o", ["brd", "ct"]], + ǫ: ["o", ["gnkc"]], + ǭ: ["o", ["gnkc", "mc"]], + ō: ["o", ["mc"]], + ṓ: ["o", ["mc", "ct"]], + ṑ: ["o", ["mc", "gr"]], + ỏ: ["o", ["ha"]], + ȍ: ["o", ["gr", "gr"]], + ȏ: ["o", ["bri"]], + ơ: ["o", ["hr"]], ớ: ["o", ["hr", "ct"]], ờ: ["o", ["hr", "gr"]], - ở: ["o", ["hr", "ha"]], ỡ: ["o", ["hr", "tl"]], + ở: ["o", ["hr", "ha"]], ợ: ["o", ["hr", "db"]], + ọ: ["o", ["db"]], + ộ: ["o", ["cr", "db"]], // u ụ: ["u", ["db"]], diff --git a/src/glyphs/lowercase/index.ts b/src/glyphs/lowercase/index.ts index 92169bb..89d5c27 100644 --- a/src/glyphs/lowercase/index.ts +++ b/src/glyphs/lowercase/index.ts @@ -51,6 +51,14 @@ const mergeDia = (diaKeys: DiaGroup): Glyph => { [...moveDia.lf(diacritics['gr']), ...moveDia.rg(diacritics['gr'])] ) } + // check double acute + if (diaKeys.reduce((ct: number, k: keyof Font)=> ct += k === 'ct' ? 1 : 0, 0) > 1) { + return joinVector( + diaKeys.filter((k) => k != "ct").map((k) => diacritics[k]), + [...moveDia.lf(diacritics['ct']), ...moveDia.rg(diacritics['ct'])] + ) + } + // move macron down if (diaKeys.includes("mc")) { return joinVector(