Skip to content

Commit

Permalink
larger glyphs
Browse files Browse the repository at this point in the history
  • Loading branch information
nclslbrn committed May 4, 2024
1 parent f76bab3 commit 42899a1
Show file tree
Hide file tree
Showing 7 changed files with 539 additions and 483 deletions.
4 changes: 2 additions & 2 deletions demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const rotateGlyph = (g: Glyph) => g.map((l: Line) => l.map((p: Vec) => [1 - p[0]
const scaleGlyph = (g: Glyph) => g.map((l: Line) => l.map((p: Vec) => [0.25 + p[0] * 0.5, 0.25 + p[1] * 0.5]))

// font["ʙ"] = scaleGlyph(font["B"])
console.log(JSON.stringify(scaleGlyph(font['6'])))
// console.log(JSON.stringify(scaleGlyph(font['6'])))

for (let l = 0; l < lowercase.length; l++) {
if (font[lowercase[l]] === undefined) {
Expand Down Expand Up @@ -47,7 +47,7 @@ const update = () => {
fontScale = parseFloat(inputSize.value),
width = window.innerWidth - 40,
baseSize = Math.max(16, Math.min(Math.floor(Math.hypot(width, height) * fontScale), 264)),
textSize = [baseSize, baseSize * 1.2],
textSize = [baseSize, baseSize],
charPerLine = Math.floor(width / textSize[0]) - 2,
nbLines = Math.ceil(text.length / charPerLine),
margin = [
Expand Down
43 changes: 26 additions & 17 deletions src/glyphs/diacritics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ const diacritics = {
// cedilla left
cdl: [
[
[0.25, 0.7],
[0.25, 0.75],
[0.3, 0.75],
[0.3, 0.8],
[0.15, 0.7],
[0.15, 0.75],
[0.2, 0.75],
[0.2, 0.8],
[0.2, 0.8],
],
],
// cedilla right
cdr: [
[
[0.75, 0.7],
[0.75, 0.75],
[0.8, 0.75],
[0.8, 0.8],
[0.85, 0.7],
[0.85, 0.75],
[0.9, 0.75],
[0.9, 0.8],
[0.7, 0.8],
],
],
Expand Down Expand Up @@ -178,9 +178,9 @@ const diacritics = {
// hook bottom right
hbr: [
[
[0.75, 0.725],
[0.75, 0.85],
[0.85, 0.9]
[0.85, 0.725],
[0.85, 0.85],
[0.9, 0.9]
]
],
// line below
Expand All @@ -193,16 +193,17 @@ const diacritics = {
// horn
hr: [
[
[0.8, 0.3],
[0.85, 0.25],
[0.85, 0.2],
[0.85, 0.3],
[0.9, 0.25],
[0.9, 0.2],
],
],
// cross (right)
crs: [
[
[0.8, 0.3],
[0.8, 0.25],
[0.85, 0.2],
[0.85, 0.3],
[0.85, 0.25],
[0.90, 0.2],
],
],
// barred (kind of /)
Expand All @@ -212,6 +213,14 @@ const diacritics = {
[0.35, 0.8],
],
],
// ogonek
gnk: [
[
[0.85, 0.7],
[0.75, 0.75],
[0.85, 0.8]
]
]
} as Font;

export default diacritics;
Loading

0 comments on commit 42899a1

Please sign in to comment.