feat(web): lazy per-script font loading for international CAD text

The web build has no system-font access, so CAD text in non-Latin scripts
(Cyrillic, Greek, CJK, …) rendered as nothing — build_fallback was a hard
None on wasm (#141). Instead, ship per-script Noto subsets under web/fonts
(one alphabet per file, SIL OFL 1.1) and fetch them lazily over HTTP the
first time a drawing uses that script, then outline glyphs with ttf-parser.

- web_font: Script enum + script_of (char → script font), a per-script
  store with lazy fetch, and a pending queue drained by the app loop.
- CJK is split by language (chinese/japanese/korean). Han ideographs share
  code points but differ by language, so the shared block is routed by the
  document's $DWGCODEPAGE (932→JP, 949→KR, GB/936→CN); kana is always
  Japanese, Hangul always Korean. Re-tessellates when the language changes.
- build_fallback (wasm) outlines from the fetched subset; clear_fallback_cache
  lets glyphs that missed while a font was in flight reappear on load.
- PollWebFonts subscription (web only) + WebFontLoaded message drive fetches.
- Trunk copy-dir serves web/fonts; nothing is bundled into the native binary
  (desktop keeps using system fonts).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-20 16:13:26 +03:00
commit 54106ca9b0
21 changed files with 453 additions and 5 deletions

1
Cargo.lock generated
View file

@ -45,6 +45,7 @@ dependencies = [
"ttf-parser", "ttf-parser",
"ureq", "ureq",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures",
"web-sys", "web-sys",
"windows-sys 0.61.2", "windows-sys 0.61.2",
"winresource", "winresource",

View file

@ -91,8 +91,12 @@ serde_json = "1"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1" console_error_panic_hook = "0.1"
wasm-bindgen = "0.2" wasm-bindgen = "0.2"
# fetch() returns a JS Promise; bridge it to a Rust future for the per-script
# web font loader (#141).
wasm-bindgen-futures = "0.4"
js-sys = "0.3" js-sys = "0.3"
# window.open (external URLs) + Blob/anchor file downloads (Save). # window.open (external URLs) + Blob/anchor file downloads (Save) + fetch()
# (Response) for the lazy per-script web font loader (#141).
web-sys = { version = "0.3", features = [ web-sys = { version = "0.3", features = [
"Window", "Window",
"Navigator", "Navigator",
@ -101,6 +105,7 @@ web-sys = { version = "0.3", features = [
"HtmlAnchorElement", "HtmlAnchorElement",
"Blob", "Blob",
"Url", "Url",
"Response",
] } ] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend; # Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no # `webgl` enables it. `fira-sans` embeds the default UI font — the web has no

View file

@ -42,6 +42,9 @@
<!-- Trunk builds the wasm32 binary without the `solid3d` feature (no 3-D <!-- Trunk builds the wasm32 binary without the `solid3d` feature (no 3-D
solid kernel / vtkio C deps on the web). See issue #45. --> solid kernel / vtkio C deps on the web). See issue #45. -->
<link data-trunk rel="rust" data-bin="OpenCADStudio" data-cargo-no-default-features /> <link data-trunk rel="rust" data-bin="OpenCADStudio" data-cargo-no-default-features />
<!-- Per-script Noto subsets, fetched lazily at runtime (one alphabet per
file) so CAD text renders non-Latin scripts on the web. (#141) -->
<link data-trunk rel="copy-dir" href="web/fonts" />
</head> </head>
<body> <body>
<div id="loading"> <div id="loading">

View file

@ -794,6 +794,11 @@ pub enum DsField {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Message { pub enum Message {
Tick(Instant), Tick(Instant),
/// Web: periodic check for per-script fonts a drawing needs but hasn't
/// fetched yet (#141). Native: never emitted.
PollWebFonts,
/// Web: a per-script font finished fetching — `Ok(bytes)` or `Err(reason)`.
WebFontLoaded(crate::scene::text::web_font::Script, Result<Vec<u8>, String>),
OpenFile, OpenFile,
/// File picker returned. `Some((path, size_in_bytes))` → start loading; /// File picker returned. `Some((path, size_in_bytes))` → start loading;
/// `None` → user cancelled the dialog (no overlay shown). /// `None` → user cancelled the dialog (no overlay shown).

View file

@ -364,6 +364,42 @@ impl OpenCADStudio {
fn update_inner(&mut self, msg: Message) -> Task<Message> { fn update_inner(&mut self, msg: Message) -> Task<Message> {
match msg { match msg {
// Web: a drawing referenced a script whose Noto subset isn't loaded
// yet (recorded during text tessellation). Kick off one fetch per
// pending script; the result comes back as `WebFontLoaded`. (#141)
Message::PollWebFonts => {
let pending = crate::scene::text::web_font::take_pending();
if pending.is_empty() {
return Task::none();
}
Task::batch(pending.into_iter().map(|script| {
Task::perform(crate::scene::text::web_font::fetch(script), move |res| {
Message::WebFontLoaded(script, res)
})
}))
}
// Web: a per-script font arrived. Store it, drop the stale fallback
// glyph cache (entries that resolved to nothing while it loaded),
// and re-tessellate so the text appears. (#141)
Message::WebFontLoaded(script, res) => {
match res {
Ok(bytes) => {
crate::scene::text::web_font::insert(script, Some(bytes));
crate::scene::text::ttf_glyph::clear_fallback_cache();
for tab in self.tabs.iter_mut() {
tab.scene.bump_geometry();
}
}
Err(e) => {
crate::scene::text::web_font::insert(script, None);
self.command_line
.push_error(&format!("Font load failed ({script:?}): {e}"));
}
}
Task::none()
}
Message::Tick(t) => { Message::Tick(t) => {
let i = self.active_tab; let i = self.active_tab;
self.tabs[i].scene.update(t - self.start); self.tabs[i].scene.update(t - self.start);
@ -500,6 +536,15 @@ impl OpenCADStudio {
self.tabs[i].current_path = Some(path.clone()); self.tabs[i].current_path = Some(path.clone());
self.tabs[i].scene.document = doc; self.tabs[i].scene.document = doc;
// Route shared CJK ideographs to the language matching this
// drawing's code page (web per-language font split). Drop the
// glyph cache if it changed so Han re-resolves to the new
// language's font; geometry is (re)built below regardless. (#141)
if crate::scene::text::web_font::set_cjk_lang_from_codepage(
&self.tabs[i].scene.document.header.code_page,
) {
crate::scene::text::ttf_glyph::clear_fallback_cache();
}
// Current model-space annotation scale comes from the drawing's // Current model-space annotation scale comes from the drawing's
// CANNOSCALEVALUE (paper/drawing factor); the multiplier we use // CANNOSCALEVALUE (paper/drawing factor); the multiplier we use
// for text/dim sizing is its inverse (1:50 -> 0.02 -> 50.0). // for text/dim sizing is its inverse (1:50 -> 0.02 -> 50.0).
@ -1298,6 +1343,14 @@ impl OpenCADStudio {
self.sync_ribbon_from_selection(); self.sync_ribbon_from_selection();
// Grid/snap follow the newly active drawing's viewport. // Grid/snap follow the newly active drawing's viewport.
self.adopt_view_display(idx); self.adopt_view_display(idx);
// Shared CJK ideographs follow the newly active drawing's
// language; re-tessellate if it differs from the last. (#141)
if crate::scene::text::web_font::set_cjk_lang_from_codepage(
&self.tabs[idx].scene.document.header.code_page,
) {
crate::scene::text::ttf_glyph::clear_fallback_cache();
self.tabs[idx].scene.bump_geometry();
}
} }
Task::none() Task::none()
} }

View file

@ -1630,11 +1630,20 @@ impl OpenCADStudio {
} else { } else {
Subscription::none() Subscription::none()
}; };
// Web: poll for per-script fonts that a drawing's text needs but hasn't
// fetched yet. Cheap — `PollWebFonts` is a no-op when nothing is
// pending. Native has system fonts, so no polling. (#141)
#[cfg(target_arch = "wasm32")]
let web_fonts =
iced::time::every(std::time::Duration::from_millis(300)).map(|_| Message::PollWebFonts);
#[cfg(not(target_arch = "wasm32"))]
let web_fonts = Subscription::none();
iced::Subscription::batch([ iced::Subscription::batch([
frames, frames,
history_tick, history_tick,
grip_dwell, grip_dwell,
caret_blink, caret_blink,
web_fonts,
event::listen_with(|ev, status, win_id| { event::listen_with(|ev, status, win_id| {
use iced::event::Status; use iced::event::Status;
match ev { match ev {

View file

@ -2,4 +2,5 @@ pub mod lff;
pub mod font_face; pub mod font_face;
pub mod sysfont; pub mod sysfont;
pub mod ttf_glyph; pub mod ttf_glyph;
pub mod web_font;
pub mod complex_lt; pub mod complex_lt;

View file

@ -263,11 +263,35 @@ pub fn fallback_glyph(ch: char) -> Option<Arc<Glyph>> {
built built
} }
/// Web: no system fonts → no cosmic-text fallback (LFF-missing glyphs simply /// Drop the cached fallback glyphs so the next lookup re-resolves. The web
/// do not render). /// build calls this when a per-script font finishes loading: glyphs that
/// resolved to `None` while the font was still in flight then get a real
/// outline. (#141)
pub fn clear_fallback_cache() {
fallback_cache().lock().unwrap().clear();
}
/// Web: outline the glyph from the lazily-fetched per-script Noto subset that
/// covers it. Returns `None` while that font is still loading (the char renders
/// once it arrives and the fallback cache is cleared). (#141)
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
fn build_fallback(_ch: char) -> Option<Arc<Glyph>> { fn build_fallback(ch: char) -> Option<Arc<Glyph>> {
None let script = crate::scene::text::web_font::script_of(ch)?;
let bytes = crate::scene::text::web_font::request(script)?;
let face = ttf_parser::Face::parse(&bytes, 0).ok()?;
let gid = face.glyph_index(ch)?;
let k = cap_scale(&face);
let advance = face.glyph_hor_advance(gid).unwrap_or(0) as f32 * k;
let mut fl = OutlineFlattener::new(k);
face.outline_glyph(gid, &mut fl);
fl.flush();
if fl.contours.is_empty() {
return None;
}
Some(Arc::new(Glyph {
strokes: fl.contours,
advance,
}))
} }
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]

199
src/scene/text/web_font.rs Normal file
View file

@ -0,0 +1,199 @@
//! Per-script web font store + lazy fetch (#141).
//!
//! The desktop build outlines glyphs for non-LFF scripts from the user's
//! installed system fonts (see `ttf_glyph::build_fallback`). The web build has
//! no system-font access, so it instead lazily fetches a per-script Noto subset
//! — served from `fonts/<script>.ttf`, one alphabet per file — the first time a
//! drawing uses that script, then outlines glyphs from it. Splitting per script
//! keeps each download small (Latin/Cyrillic/Greek ~50100 KB; CJK loads only
//! when a CJK drawing is opened).
//!
//! The store and fetch are web-only; the desktop side keeps no-op stubs so the
//! shared call sites (`ttf_glyph`, the app message loop) compile unchanged.
use std::sync::atomic::{AtomicU8, Ordering};
/// A script we ship a Noto subset for. [`script_of`] maps a char to one.
///
/// CJK is split by language — Chinese, Japanese and Korean each get their own
/// file. Their ideographs (Han, U+4E009FFF) share the same code points but
/// differ in glyph shape, so the shared block is routed by the document's
/// language (see [`set_cjk_lang_from_codepage`]); kana is always Japanese and
/// Hangul always Korean.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Script {
Latin,
Cyrillic,
Greek,
Arabic,
Hebrew,
Thai,
Devanagari,
Chinese,
Japanese,
Korean,
}
impl Script {
/// Same-origin asset path the web build fetches this script's font from.
/// Must match the files produced by `web/fonts/generate.sh`.
pub fn asset(self) -> &'static str {
match self {
Script::Latin => "fonts/latin.ttf",
Script::Cyrillic => "fonts/cyrillic.ttf",
Script::Greek => "fonts/greek.ttf",
Script::Arabic => "fonts/arabic.ttf",
Script::Hebrew => "fonts/hebrew.ttf",
Script::Thai => "fonts/thai.ttf",
Script::Devanagari => "fonts/devanagari.ttf",
Script::Chinese => "fonts/chinese.ttf",
Script::Japanese => "fonts/japanese.ttf",
Script::Korean => "fonts/korean.ttf",
}
}
}
/// Language used to render shared Han ideographs: 0 = Chinese, 1 = Japanese,
/// 2 = Korean. Set from the active document's code page.
static CJK_LANG: AtomicU8 = AtomicU8::new(0);
fn cjk_lang() -> Script {
match CJK_LANG.load(Ordering::Relaxed) {
1 => Script::Japanese,
2 => Script::Korean,
_ => Script::Chinese,
}
}
/// Point the shared-Han routing at a language based on a DWG/DXF code page
/// (`$DWGCODEPAGE`), e.g. `ANSI_932` → Japanese, `ANSI_949` → Korean, GB/936 or
/// anything else → Chinese. Returns `true` if the language changed (the caller
/// then clears the glyph cache and re-tessellates).
pub fn set_cjk_lang_from_codepage(code_page: &str) -> bool {
let c = code_page.to_ascii_uppercase();
let lang = if c.contains("932") || c.contains("SJIS") || c.contains("SHIFT") {
1 // Japanese (Shift-JIS)
} else if c.contains("949") || c.contains("KOR") || c.contains("UHC") {
2 // Korean
} else {
0 // Chinese (936 / GB / 950 / Big5) or non-CJK default
};
CJK_LANG.swap(lang, Ordering::Relaxed) != lang
}
/// The script font that covers `ch`, or `None` for control / uncovered code
/// points. Ranges mirror the subset unicode ranges in `web/fonts/generate.sh`.
pub fn script_of(ch: char) -> Option<Script> {
Some(match ch as u32 {
0x0000..=0x024F | 0x1E00..=0x1EFF | 0x2000..=0x206F => Script::Latin,
0x0370..=0x03FF | 0x1F00..=0x1FFF => Script::Greek,
0x0400..=0x052F | 0x2DE0..=0x2DFF | 0xA640..=0xA69F => Script::Cyrillic,
0x0590..=0x05FF | 0xFB1D..=0xFB4F => Script::Hebrew,
0x0600..=0x06FF | 0x0750..=0x077F | 0x08A0..=0x08FF | 0xFB50..=0xFDFF | 0xFE70..=0xFEFF => {
Script::Arabic
}
0x0900..=0x097F => Script::Devanagari,
// Hangul → always Korean; kana → always Japanese.
0x1100..=0x11FF | 0x3130..=0x318F | 0xAC00..=0xD7A3 => Script::Korean,
0x3040..=0x30FF | 0x31F0..=0x31FF => Script::Japanese,
// Shared Han + CJK symbols + fullwidth → routed by the document language.
0x3000..=0x303F | 0x3400..=0x4DBF | 0x4E00..=0x9FFF | 0xF900..=0xFAFF | 0xFF00..=0xFFEF => {
cjk_lang()
}
_ => return None,
})
}
// ── Web store ───────────────────────────────────────────────────────────────
#[cfg(target_arch = "wasm32")]
mod imp {
use super::Script;
use std::collections::HashMap;
use std::sync::{Arc, Mutex, OnceLock};
enum State {
Loading,
Loaded(Arc<Vec<u8>>),
Failed,
}
#[derive(Default)]
struct Store {
states: HashMap<Script, State>,
/// Scripts requested but not yet fetched; the app drains this and kicks
/// off the fetch tasks.
pending: Vec<Script>,
}
fn store() -> &'static Mutex<Store> {
static S: OnceLock<Mutex<Store>> = OnceLock::new();
S.get_or_init(|| Mutex::new(Store::default()))
}
/// Loaded font bytes for `script`, or `None` — queueing a fetch the first
/// time a script is missed so the app loop can load it.
pub fn request(script: Script) -> Option<Arc<Vec<u8>>> {
let mut s = store().lock().unwrap();
match s.states.get(&script) {
Some(State::Loaded(b)) => Some(b.clone()),
Some(_) => None, // Loading or Failed — don't re-queue.
None => {
s.states.insert(script, State::Loading);
s.pending.push(script);
None
}
}
}
/// Drain the scripts awaiting a fetch.
pub fn take_pending() -> Vec<Script> {
std::mem::take(&mut store().lock().unwrap().pending)
}
/// Record a fetch result: `Some(bytes)` on success, `None` on failure.
pub fn insert(script: Script, bytes: Option<Vec<u8>>) {
let st = match bytes {
Some(b) => State::Loaded(Arc::new(b)),
None => State::Failed,
};
store().lock().unwrap().states.insert(script, st);
}
/// Fetch a script font over HTTP from the same origin.
pub async fn fetch(script: Script) -> Result<Vec<u8>, String> {
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::JsFuture;
let win = web_sys::window().ok_or("no window")?;
let resp_val = JsFuture::from(win.fetch_with_str(script.asset()))
.await
.map_err(|e| format!("{e:?}"))?;
let resp: web_sys::Response = resp_val.dyn_into().map_err(|_| "bad response".to_string())?;
if !resp.ok() {
return Err(format!("HTTP {}", resp.status()));
}
let ab = JsFuture::from(resp.array_buffer().map_err(|e| format!("{e:?}"))?)
.await
.map_err(|e| format!("{e:?}"))?;
Ok(js_sys::Uint8Array::new(&ab).to_vec())
}
}
#[cfg(not(target_arch = "wasm32"))]
mod imp {
use super::Script;
use std::sync::Arc;
pub fn request(_script: Script) -> Option<Arc<Vec<u8>>> {
None
}
pub fn take_pending() -> Vec<Script> {
Vec::new()
}
pub fn insert(_script: Script, _bytes: Option<Vec<u8>>) {}
pub async fn fetch(_script: Script) -> Result<Vec<u8>, String> {
Err("web only".into())
}
}
pub use imp::{fetch, insert, request, take_pending};

102
web/fonts/OFL.txt Normal file
View file

@ -0,0 +1,102 @@
The fonts in this directory are subsets of Google's Noto fonts, generated by
generate.sh. They are redistributed under the SIL Open Font License v1.1.
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/arabic)
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/hebrew)
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/thai)
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/devanagari)
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. (Noto Sans CJK)
Noto is a trademark of Google LLC. Noto has no Reserved Font Name.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

BIN
web/fonts/arabic.ttf Normal file

Binary file not shown.

BIN
web/fonts/chinese.ttf Normal file

Binary file not shown.

BIN
web/fonts/cyrillic.ttf Normal file

Binary file not shown.

BIN
web/fonts/devanagari.ttf Normal file

Binary file not shown.

46
web/fonts/generate.sh Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Regenerate the per-script Noto subsets served to the web build.
# Each script lives in its own TTF so a browser only fetches the alphabets a
# drawing actually uses. Source: Noto fonts (SIL OFL 1.1 — see OFL.txt).
#
# Requires: pip install --break-system-packages fonttools brotli
set -euo pipefail
RAW="https://github.com/notofonts/notofonts.github.io/raw/main/fonts"
sub() { python3 -m fontTools.subset "$1" --unicodes="$2" --output-file="$3" \
--no-hinting --desubroutinize --layout-features='*' --notdef-outline \
--name-IDs='*' --recalc-bounds 2>/dev/null; }
dl() { curl -sL -o "$1" "$2"; }
# Latin / Cyrillic / Greek share one Noto source.
dl /tmp/NotoSans.ttf "$RAW/NotoSans/hinted/ttf/NotoSans-Regular.ttf"
sub /tmp/NotoSans.ttf "U+0000-024F,U+1E00-1EFF,U+2000-206F,U+20A0-20BF,U+2122,U+2190-21FF,U+2200-22FF" latin.ttf
sub /tmp/NotoSans.ttf "U+0400-04FF,U+0500-052F,U+2DE0-2DFF,U+A640-A69F" cyrillic.ttf
sub /tmp/NotoSans.ttf "U+0370-03FF,U+1F00-1FFF" greek.ttf
# One source per remaining script.
dl /tmp/NotoArabic.ttf "$RAW/NotoSansArabic/hinted/ttf/NotoSansArabic-Regular.ttf"
sub /tmp/NotoArabic.ttf "U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF" arabic.ttf
dl /tmp/NotoHebrew.ttf "$RAW/NotoSansHebrew/hinted/ttf/NotoSansHebrew-Regular.ttf"
sub /tmp/NotoHebrew.ttf "U+0590-05FF,U+FB1D-FB4F" hebrew.ttf
dl /tmp/NotoThai.ttf "$RAW/NotoSansThai/hinted/ttf/NotoSansThai-Regular.ttf"
sub /tmp/NotoThai.ttf "U+0E00-0E7F" thai.ttf
dl /tmp/NotoDeva.ttf "$RAW/NotoSansDevanagari/hinted/ttf/NotoSansDevanagari-Regular.ttf"
sub /tmp/NotoDeva.ttf "U+0900-097F,U+A8E0-A8FF" devanagari.ttf
# CJK comes from the noto-cjk repo (CFF/OTF; ttf-parser reads CFF outlines) and
# is split by language: Chinese, Japanese and Korean each get their own file.
# Han ideographs share code points but differ in glyph shape, so each language
# ships its own. These are the heavy ones — lazy-loaded per language only when a
# drawing in that language is opened.
CJK="https://github.com/notofonts/noto-cjk/raw/main/Sans/OTF"
dl /tmp/NotoSC.otf "$CJK/SimplifiedChinese/NotoSansCJKsc-Regular.otf"
sub /tmp/NotoSC.otf "U+3000-303F,U+4E00-9FFF,U+FF00-FFEF" chinese.ttf
dl /tmp/NotoJP.otf "$CJK/Japanese/NotoSansCJKjp-Regular.otf"
sub /tmp/NotoJP.otf "U+3000-303F,U+3040-30FF,U+31F0-31FF,U+4E00-9FFF,U+FF00-FFEF" japanese.ttf
dl /tmp/NotoKR.otf "$CJK/Korean/NotoSansCJKkr-Regular.otf"
sub /tmp/NotoKR.otf "U+1100-11FF,U+3130-318F,U+AC00-D7A3" korean.ttf

BIN
web/fonts/greek.ttf Normal file

Binary file not shown.

BIN
web/fonts/hebrew.ttf Normal file

Binary file not shown.

BIN
web/fonts/japanese.ttf Normal file

Binary file not shown.

BIN
web/fonts/korean.ttf Normal file

Binary file not shown.

BIN
web/fonts/latin.ttf Normal file

Binary file not shown.

BIN
web/fonts/thai.ttf Normal file

Binary file not shown.