Modern Apps git

← Modern-Apps.git

findfamily: render accented map labels (#821)

Commit
90ce2c3b6106ea3b746adc80870e6cede3f52b86
Author
vayun-mathur <[email protected]>
When
2026-10-16 03:50 UTC (1 month ago)
Parents
e2ab974

Diff

library/map/src/main/rust/src/tile/glyph/metrics.rs
diff --git a/library/map/src/main/rust/src/tile/glyph/metrics.rs b/library/map/src/main/rust/src/tile/glyph/metrics.rsindex d47bdcfd32..698f3619d2 100644--- a/library/map/src/main/rust/src/tile/glyph/metrics.rs+++ b/library/map/src/main/rust/src/tile/glyph/metrics.rs@@ -7,8 +7,13 @@ /// so swapping in a 2048-upem face fails a test instead of shrinking the map's text. pub const UP_EM: u16 = 1000; -/// Atlas grid: 16×16 cells.-pub const ATLAS_COLS: u32 = 16;+/// Atlas grid: 32×32 cells.+///+/// 1024 cells: ASCII (95) + Latin-1 Supplement (96) + Latin Extended-A (128) is+/// 319 codepoints × 2 weights = 638 cells, with room for Latin Extended-B later.+/// Was 16×16 (256 cells, 190 used), which fit ASCII only — every accented letter+/// in a Budapest street name had no atlas entry and shaping skipped it (#821).+pub const ATLAS_COLS: u32 = 32; /// Cell size in px, including padding. 64px at 4x raster of a 16px glyph. pub const CELL_PX: u32 = 64; /// Atlas edge in px.@@ -73,8 +78,16 @@ pub fn fonts_staged() -> bool {         && MEDIUM_TTF.starts_with(&[0x00, 0x01, 0x00, 0x00]) } -/// The Latin set M1 shapes: printable ASCII. `name:en` coalesced by the tiler is-/// Latin in the overwhelming NA case; CJK/others are a stated M5.+/// The Latin set M1 shapes: printable ASCII plus the accented letters of+/// Latin-1 Supplement and Latin Extended-A, so Hungarian `őű`, French `éè`,+/// German `äöüß` and friends render instead of being skipped by shaping (#821).+/// CJK/others remain a stated M5. pub fn charset() -> Vec<char> {-    (0x20u8..=0x7Eu8).map(|b| b as char).collect()+    let mut out: Vec<char> = (0x20u8..=0x7Eu8).map(|b| b as char).collect();+    // U+00A0–U+00FF except the soft hyphen (U+00AD): it is invisible and only a+    // line-break opportunity, which the wrapper handles as a breakable already.+    out.extend((0xA0u32..=0xFFu32).filter(|&c| c != 0xAD).filter_map(char::from_u32));+    // U+0100–U+017F: Central/Eastern European (Hungarian őű, Polish łż, Czech ř…).+    out.extend((0x100u32..=0x17Fu32).filter_map(char::from_u32));+    out }
library/map/src/main/rust/src/tile/glyph/mod.rs
diff --git a/library/map/src/main/rust/src/tile/glyph/mod.rs b/library/map/src/main/rust/src/tile/glyph/mod.rsindex eaa4ed52c4..07562224e8 100644--- a/library/map/src/main/rust/src/tile/glyph/mod.rs+++ b/library/map/src/main/rust/src/tile/glyph/mod.rs@@ -16,9 +16,9 @@ //! APK, which shipped these 1.5 MB a second time for bytes no code path reads. //! //! Rasterising at first use costs milliseconds once:-//! ~95 Latin codepoints × 2 weights, each a 4x `ab_glyph` rasterise followed by an+//! ~319 Latin codepoints × 2 weights, each a 4x `ab_glyph` rasterise followed by an //! 8SSEDT distance transform over a ≤128px cell. The atlas is a single R8 image-//! (16×16 cells of 64px = 1024px) uploaded to Vulkan once.+//! (32×32 cells of 64px = 2048px) uploaded to Vulkan once. //! //! # Metrics live here, shaping in `tess::text` //!
library/map/src/main/rust/src/tile/glyph/tests.rs
diff --git a/library/map/src/main/rust/src/tile/glyph/tests.rs b/library/map/src/main/rust/src/tile/glyph/tests.rsindex 8be0daaa17..dd3a306add 100644--- a/library/map/src/main/rust/src/tile/glyph/tests.rs+++ b/library/map/src/main/rust/src/tile/glyph/tests.rs@@ -254,3 +254,24 @@ fn uv_rects_stay_inside_the_image() {         }     } }++/// Issue 821: a Budapest street name must round-trip every character through the+/// atlas — diacritics included. `Erzsébet híd` carries `é` (Latin-1) and `í`;+/// `Árpád híd` adds `Á`. A missing entry here is a letter dropped from the map.+#[test]+fn budapest_street_names_shape_every_character() {+    if !real_fonts_staged() {+        eprintln!("SKIP: staged TTFs are 404 pages, not fonts");+        return;+    }+    let atlas = GlyphAtlas::build();+    for name in ["Erzsébet híd", "Árpád híd", "Dózsa György út", "Kossuth Lajos utca"] {+        for ch in name.chars().filter(|&c| c != ' ') {+            assert!(+                atlas.metrics(Weight::Regular, ch).is_some(),+                "{name:?}: {ch:?} (U+{:04X}) has no atlas entry",+                ch as u32,+            );+        }+    }+}