feat(site): put common symbols in OpenMono's Latin files

This commit is contained in:
David Hill 2026-11-20 22:43:17 -06:00
parent 3fba739240
commit e508bb6444
12 changed files with 76 additions and 52 deletions

View file

@ -5,13 +5,14 @@
# rebuilds from those copies. The copies are OpenMono 1.000.
#
# Each style is three files, split by unicode-range like Inter: "latin" (Latin, punctuation, arrows,
# shapes and box drawing, what the site sets in mono), "cyrillic" (the Russian and Ukrainian pages,
# and those languages' names in a language menu) and "rest" (every other character the font has),
# each only fetched when a page uses one of its characters. No character is left out. OpenCode
# Desktop's script (packages/app/script/openmono.py) follows the same rules, so both make the same
# files. The ranges are written to src/asset/fonts/openmono.json for mono-fonts.ts; if they change,
# write them into src/style/fonts.css too (test/fonts.test.ts compares the two). packages/data/app
# serves copies of the regular and bold files; refresh them too.
# shapes, box drawing and a few keys and common symbols: what the site sets in mono), "cyrillic" (the
# Russian and Ukrainian pages, and those languages' names in a language menu) and "rest" (every other
# character the font has), each only fetched when a page uses one of its characters. No character is
# left out. OpenCode Desktop's script (packages/app/script/openmono.py) follows the same rules; with
# the same lists of keys and symbols as below, both make the same files. The ranges are written to
# src/asset/fonts/openmono.json for mono-fonts.ts; if they change, write them into
# src/style/fonts.css too (test/fonts.test.ts compares the two). packages/data/app serves copies of
# the regular and bold files; refresh them too.
#
# The app build has no ligatures and every character one cell wide (0.6 em, like the metric-matched
# fallbacks), so no CSS feature is needed. Only the layout features for accents are kept.
@ -41,9 +42,22 @@ styles = {
}
latin = [(0x0000, 0x017F), (0x2000, 0x206F), (0x20AC, 0x20AC), (0x2122, 0x2122), (0x2190, 0x21FF), (0x2212, 0x2212), (0x2500, 0x25FF)]
# The keys that shortcuts name (⌃ ⌘ ⌥ ⌫ ⎋ ⏎, as in Inter's Latin file), which are in the Latin file too: the
# search box on every page shows ⌘K, and from the "rest" file that one character would cost 124 kB.
# Desktop's script has no such list, so its Latin files lack these six.
# search box on every page shows ⌘K, and from the "rest" file that one character would cost 123 kB.
keys = {0x2303, 0x2318, 0x2325, 0x232B, 0x238B, 0x23CE}
# Common symbols, in the Latin file too for the same reason. Each is one a terminal prints as a status
# mark, or one that a page of opencode.ai, its docs, the Console or opentui.com sets in mono:
symbols = {
# ✓ ✗ ✕ ✖ ⚠: status marks (✓ is in opentui.com's docs and the Console's demos)
*(0x2713, 0x2717, 0x2715, 0x2716, 0x26A0),
# ∙ ⋅: the dots that two of opentui.com's terminal recordings draw
*(0x2219, 0x22C5),
# ≈ ≠ ≤ ≥ ∞ √ ∑: plain math (≈ is on /font, ∞ is the Console's unlimited allowance)
*(0x2248, 0x2260, 0x2264, 0x2265, 0x221E, 0x221A, 0x2211),
# ⋯ and the replacement character: in code on a changelog page
*(0x22EF, 0xFFFD),
# ⁰ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹, ₀ ₁ and σ: the numbers on /font (¹ ² ³ are in Latin-1). Σ too: the page sets its σ in capitals
*(0x2070, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079, 0x2080, 0x2081, 0x03C3, 0x03A3),
}
cyrillic = [(0x0400, 0x052F), (0x1C80, 0x1C8F), (0x2DE0, 0x2DFF), (0xA640, 0xA69F)]
# The stress marks, which the Cyrillic file has too: a stressed letter such as у́ has no code point of
# its own, and a browser sets a letter and its mark from one file or falls back for both. (A Latin
@ -126,10 +140,12 @@ with tempfile.TemporaryDirectory() as folder:
if wide:
raise SystemExit(f"Nothing was written. {inputs[file]} is not the one-cell build: {ranges(wide)} are not 600 units wide")
codes = set(font.getBestCmap())
if (keys | symbols) - codes:
raise SystemExit(f"Nothing was written. {inputs[file]} lacks {ranges((keys | symbols) - codes)}, which the Latin file is to have")
groups = {
"latin": {code for code in codes if within(code, latin) or code in keys},
"latin": {code for code in codes if within(code, latin) or code in keys | symbols},
"cyrillic": {code for code in codes if within(code, cyrillic) or code in stress},
"rest": {code for code in codes if not within(code, latin + cyrillic) and code not in keys},
"rest": {code for code in codes if not within(code, latin + cyrillic) and code not in keys | symbols},
}
for group, chars in groups.items():
if members.setdefault(group, chars) != chars:

View file

@ -1,5 +1,5 @@
{
"latin": "U+0020-007E, U+00A0-017F, U+2000-200D, U+2010-2029, U+202F-2064, U+20AC, U+2122, U+2190-21FF, U+2212, U+2303, U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF",
"latin": "U+0020-007E, U+00A0-017F, U+03A3, U+03C3, U+2000-200D, U+2010-2029, U+202F-2064, U+2070, U+2074-2079, U+2080-2081, U+20AC, U+2122, U+2190-21FF, U+2211-2212, U+2219-221A, U+221E, U+2248, U+2260, U+2264-2265, U+22C5, U+22EF, U+2303, U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF, U+26A0, U+2713, U+2715-2717, U+FFFD",
"cyrillic": "U+0300-0301, U+0400-052F, U+A64C-A64D",
"rest": "U+0180-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2070-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2211, U+2213-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+26A0, U+2713, U+2715-2717, U+2731, U+2736, U+274C, U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+FFFD, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D, U+1FB82-1FBE7"
"rest": "U+0180-03A1, U+03A4-03C2, U+03C4-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2071, U+207A-207F, U+2082-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2210, U+2213-2218, U+221B-221D, U+221F-2247, U+2249-225F, U+2261-2263, U+2266-22C4, U+22C6-22EE, U+22F0-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+2731, U+2736, U+274C, U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D, U+1FB82-1FBE7"
}

View file

@ -17,9 +17,9 @@ import ranges from "../../asset/fonts/openmono.json"
// monospace face for every visitor (--font-mono in site.css). script/openmono.py builds each
// style's files from the app build of OpenMono 1.000, the build OpenCode Desktop takes its files
// from (no ligatures, every character one cell wide): "latin" (Latin, punctuation, arrows, shapes,
// box drawing and the keys shortcuts name), "cyrillic" (with the stress marks) and "rest" (the
// font's other characters, such as Greek, Vietnamese and math), each fetched only when a page uses
// one of its characters. Every character advances 0.6 em.
// box drawing, the keys shortcuts name and common symbols such as ✓ and ≈), "cyrillic" (with the
// stress marks) and "rest" (the font's other characters, such as Greek, Vietnamese and math), each
// fetched only when a page uses one of its characters. Every character advances 0.6 em.
export const monoFontLatin = regularLatin
// Settings › Mono font (development only): the family ahead of the stack. IBM Plex Mono loads from

View file

@ -10,8 +10,9 @@
font-style: normal;
font-display: swap;
unicode-range:
U+0020-007E, U+00A0-017F, U+2000-200D, U+2010-2029, U+202F-2064, U+20AC, U+2122, U+2190-21FF, U+2212, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF;
U+0020-007E, U+00A0-017F, U+03A3, U+03C3, U+2000-200D, U+2010-2029, U+202F-2064, U+2070, U+2074-2079, U+2080-2081,
U+20AC, U+2122, U+2190-21FF, U+2211-2212, U+2219-221A, U+221E, U+2248, U+2260, U+2264-2265, U+22C5, U+22EF, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF, U+26A0, U+2713, U+2715-2717, U+FFFD;
}
@font-face {
@ -21,13 +22,14 @@
font-style: normal;
font-display: swap;
unicode-range:
U+0180-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2070-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8,
U+20EB, U+2100-2121, U+2124-218B, U+2200-2211, U+2213-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A,
U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+26A0, U+2713, U+2715-2717, U+2731, U+2736, U+274C,
U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06,
U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B,
U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+FFFD, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B,
U+1DF05-1DF1D, U+1FB82-1FBE7;
U+0180-03A1, U+03A4-03C2, U+03C4-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2071, U+207A-207F,
U+2082-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2210, U+2213-2218,
U+221B-221D, U+221F-2247, U+2249-225F, U+2261-2263, U+2266-22C4, U+22C6-22EE, U+22F0-2302, U+2304-2317, U+2319-2324,
U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+2731, U+2736, U+274C, U+2794,
U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC,
U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8,
U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D,
U+1FB82-1FBE7;
}
@font-face {
@ -46,8 +48,9 @@
font-style: normal;
font-display: swap;
unicode-range:
U+0020-007E, U+00A0-017F, U+2000-200D, U+2010-2029, U+202F-2064, U+20AC, U+2122, U+2190-21FF, U+2212, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF;
U+0020-007E, U+00A0-017F, U+03A3, U+03C3, U+2000-200D, U+2010-2029, U+202F-2064, U+2070, U+2074-2079, U+2080-2081,
U+20AC, U+2122, U+2190-21FF, U+2211-2212, U+2219-221A, U+221E, U+2248, U+2260, U+2264-2265, U+22C5, U+22EF, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF, U+26A0, U+2713, U+2715-2717, U+FFFD;
}
@font-face {
@ -57,13 +60,14 @@
font-style: normal;
font-display: swap;
unicode-range:
U+0180-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2070-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8,
U+20EB, U+2100-2121, U+2124-218B, U+2200-2211, U+2213-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A,
U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+26A0, U+2713, U+2715-2717, U+2731, U+2736, U+274C,
U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06,
U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B,
U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+FFFD, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B,
U+1DF05-1DF1D, U+1FB82-1FBE7;
U+0180-03A1, U+03A4-03C2, U+03C4-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2071, U+207A-207F,
U+2082-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2210, U+2213-2218,
U+221B-221D, U+221F-2247, U+2249-225F, U+2261-2263, U+2266-22C4, U+22C6-22EE, U+22F0-2302, U+2304-2317, U+2319-2324,
U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+2731, U+2736, U+274C, U+2794,
U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC,
U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8,
U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D,
U+1FB82-1FBE7;
}
@font-face {
@ -82,8 +86,9 @@
font-style: italic;
font-display: swap;
unicode-range:
U+0020-007E, U+00A0-017F, U+2000-200D, U+2010-2029, U+202F-2064, U+20AC, U+2122, U+2190-21FF, U+2212, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF;
U+0020-007E, U+00A0-017F, U+03A3, U+03C3, U+2000-200D, U+2010-2029, U+202F-2064, U+2070, U+2074-2079, U+2080-2081,
U+20AC, U+2122, U+2190-21FF, U+2211-2212, U+2219-221A, U+221E, U+2248, U+2260, U+2264-2265, U+22C5, U+22EF, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF, U+26A0, U+2713, U+2715-2717, U+FFFD;
}
@font-face {
@ -93,13 +98,14 @@
font-style: italic;
font-display: swap;
unicode-range:
U+0180-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2070-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8,
U+20EB, U+2100-2121, U+2124-218B, U+2200-2211, U+2213-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A,
U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+26A0, U+2713, U+2715-2717, U+2731, U+2736, U+274C,
U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06,
U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B,
U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+FFFD, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B,
U+1DF05-1DF1D, U+1FB82-1FBE7;
U+0180-03A1, U+03A4-03C2, U+03C4-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2071, U+207A-207F,
U+2082-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2210, U+2213-2218,
U+221B-221D, U+221F-2247, U+2249-225F, U+2261-2263, U+2266-22C4, U+22C6-22EE, U+22F0-2302, U+2304-2317, U+2319-2324,
U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+2731, U+2736, U+274C, U+2794,
U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC,
U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8,
U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D,
U+1FB82-1FBE7;
}
@font-face {
@ -118,8 +124,9 @@
font-style: italic;
font-display: swap;
unicode-range:
U+0020-007E, U+00A0-017F, U+2000-200D, U+2010-2029, U+202F-2064, U+20AC, U+2122, U+2190-21FF, U+2212, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF;
U+0020-007E, U+00A0-017F, U+03A3, U+03C3, U+2000-200D, U+2010-2029, U+202F-2064, U+2070, U+2074-2079, U+2080-2081,
U+20AC, U+2122, U+2190-21FF, U+2211-2212, U+2219-221A, U+221E, U+2248, U+2260, U+2264-2265, U+22C5, U+22EF, U+2303,
U+2318, U+2325, U+232B, U+238B, U+23CE, U+2500-25FF, U+26A0, U+2713, U+2715-2717, U+FFFD;
}
@font-face {
@ -129,13 +136,14 @@
font-style: italic;
font-display: swap;
unicode-range:
U+0180-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2070-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8,
U+20EB, U+2100-2121, U+2124-218B, U+2200-2211, U+2213-2302, U+2304-2317, U+2319-2324, U+2326-232A, U+232D-238A,
U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+26A0, U+2713, U+2715-2717, U+2731, U+2736, U+274C,
U+2794, U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06,
U+2ADC, U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B,
U+E0B8, U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+FFFD, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B,
U+1DF05-1DF1D, U+1FB82-1FBE7;
U+0180-03A1, U+03A4-03C2, U+03C4-03FF, U+0531-058F, U+0E3F, U+1D00-1DBF, U+1E00-1FFE, U+2071, U+207A-207F,
U+2082-209C, U+20A1-20AB, U+20AD-20C0, U+20D2, U+20D8, U+20EB, U+2100-2121, U+2124-218B, U+2200-2210, U+2213-2218,
U+221B-221D, U+221F-2247, U+2249-225F, U+2261-2263, U+2266-22C4, U+22C6-22EE, U+22F0-2302, U+2304-2317, U+2319-2324,
U+2326-232A, U+232D-238A, U+238D-23CC, U+23CF-2429, U+266D, U+266F, U+2687, U+2699, U+2731, U+2736, U+274C, U+2794,
U+279C-279E, U+27DC, U+27E6-27EB, U+27F3, U+2916, U+2948, U+294A, U+2987-2988, U+29BF, U+2A00, U+2A05-2A06, U+2ADC,
U+2AEE, U+2B0E-2B13, U+2B16, U+2B1D, U+2B25, U+2B29-2B2A, U+2B30, U+2C60-2C7F, U+A720-A7FF, U+AB30-AB6B, U+E0B8,
U+E0BA, U+E0BC, U+E0BE, U+F882-F892, U+FB01-FB02, U+10788-107B9, U+1CD06-1CEAB, U+1D538-1D56B, U+1DF05-1DF1D,
U+1FB82-1FBE7;
}
@font-face {