fix: keep TFT snapshots alive when labels need unbundled glyph ranges

MapLibre's MapSnapshotter aborts the whole still image on any glyph load
error. The offline style only bundled Noto Sans ranges 0-2047, while the
Asturias archive labels use U+1E36/U+1E37 (Asturian Ḷḷ) and typographic
quotes/dashes, so the TFT failed with SDK/STYLE_READY UNKNOWN/UNKNOWN
("Could not read asset") whenever such a label was in view, while the
phone MapView kept working.

Bundle the unmodified demotiles ranges 7680-7935 and 8192-8447, add an
empty placeholder for every other BMP range, report missing assets as
NOT_FOUND, and release 0.13.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014YKH4z66ZCe2wK4GvgRg7g
This commit is contained in:
Claude committed 2026-10-26 02:19:57 +00:00
1 parent 1a14b3164d
commit bca606170f
259 files changed
+846 -9

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ Each generated package preserves OSM attribution and ODbL provenance. Geofabrik
Maps and installed places can be viewed without a network connection. Search for local places does not query Nominatim. Address search and route calculation need the configured online services. Following a previously calculated route can continue from its saved geometry, but route calculation and recalculation still need a network connection.
Map detail is bounded by package coverage and maximum zoom. POI data can be absent or outdated. Glyph coverage is limited to the bundled font ranges, so some writing systems or characters may not render. OSM data does not certify business status, road access, motorcycle suitability, speed limits, or camera completeness.
Map detail is bounded by package coverage and maximum zoom. POI data can be absent or outdated. Glyph coverage is limited to the bundled font ranges, so some writing systems or characters may not render. Every other Unicode range ships as an empty placeholder: uncovered characters are omitted from a label instead of failing the TFT snapshot. Keep placeholders for all 256 ranges when changing fonts (`tools/offline/fill-glyph-ranges.py`). OSM data does not certify business status, road access, motorcycle suitability, speed limits, or camera completeness.
The owner confirmed that the bundled Asturias map works offline on a Xiaomi 11 Lite 5G NE running Android 14. On 2026-10-12, the owner reported about 20 minutes of working TFT map display followed by persistent `Mapa no disponible` while the phone map continued working, with an offline map installed. This confirms some successful TFT rendering, but not sustained reliability or the exact source selected by the TFT at failure. See [Testing](TESTING.md).
+1 -1
View File
@@ -26,7 +26,7 @@ Relevant inactive markers are excluded (`disused`/`abandoned` and prefixes for s
## Contract and SQLite
The original core `OfflinePlace` retains ID, name, `PlaceCategory`, position, optional address/openingHours/website/phone, and optional straight-line distance. `normalizePlaceSearch` uses NFD, removes combining marks, lowercases independently of locale, compacts whitespace/control/format characters, and preserves non-Latin alphabets. Python generates `search_name` with the same algorithm. Map glyphs remain limited to Unicode 0–2047; native list text does not depend on these PBF glyphs.
The original core `OfflinePlace` retains ID, name, `PlaceCategory`, position, optional address/openingHours/website/phone, and optional straight-line distance. `normalizePlaceSearch` uses NFD, removes combining marks, lowercases independently of locale, compacts whitespace/control/format characters, and preserves non-Latin alphabets. Python generates `search_name` with the same algorithm. Map glyphs remain limited to Unicode 0–2047, 7680–7935 and 8192–8447; native list text does not depend on these PBF glyphs.
Schema: `places(id TEXT PRIMARY KEY, name TEXT, search_name TEXT, category TEXT, latitude REAL, longitude REAL, address TEXT, opening_hours TEXT, website TEXT, phone TEXT)`. Name/search/category/position are required and categories are checked. Indexes: `(category,latitude,longitude)`, `(latitude,longitude)`, `search_name`. `metadata(key TEXT PRIMARY KEY,value TEXT)` identifies version/coverage. Android queries are parameterized and escape `%`, `_`, and backslash via `escapePlaceLike` with `ESCAPE '\'`; an apostrophe remains data. Bounded substring search does not make the name index a full-text-search guarantee for millions of places.
+2 -2
View File
@@ -4,7 +4,7 @@ Initial proposal dated 2026-09-29, updated 2026-09-30. NavFrame 0.10 introduced
## Current data
Asturias has a 34,617,483-byte PMTiles map containing roads, places/towns, inland water, land cover, and buildings at zoom 6–14, plus an SQLite catalog of 11,457 POIs. Cantabria is a separate `.navframe` map/POI package. Both retain separate source extracts and hashes. Maps are selected as individual regional sources; place search combines installed catalogs using the chosen location's coverage. The APK includes Noto Sans Regular glyphs for Unicode 0–2047. Current app limits are 1 GiB total, 600 MiB per compressed regional package, and up to twelve installed versions. These are prototype limits, not demonstrated capacity for all regions.
Asturias has a 34,617,483-byte PMTiles map containing roads, places/towns, inland water, land cover, and buildings at zoom 6–14, plus an SQLite catalog of 11,457 POIs. Cantabria is a separate `.navframe` map/POI package. Both retain separate source extracts and hashes. Maps are selected as individual regional sources; place search combines installed catalogs using the chosen location's coverage. The APK includes Noto Sans Regular glyphs for Unicode 0–2047, 7680–7935 and 8192–8447; every other range is an empty placeholder so a missing character cannot abort a TFT snapshot. Current app limits are 1 GiB total, 600 MiB per compressed regional package, and up to twelve installed versions. These are prototype limits, not demonstrated capacity for all regions.
## Offline places for Asturias
@@ -49,7 +49,7 @@ Each manifest should contain stable region ID, label, coverage polygon/bounds, p
Select by **actual coverage**, not only rectangles: countries/subregions have irregular boundaries, islands, and overlap. Before a trip, install regions intersecting the route with edge overlap. Do not present a bbox as continuous coverage. A multi-region renderer must mount the required sources and avoid duplicate features; SQLite search combines indexes and deduplicates by OSM identity. The current map selector still selects an individual regional map, so combining adjacent regions requires new work.
For European/global use, add shared, versioned glyph coverage by writing system. Latin/Greek/Cyrillic are broadly covered by current ranges, but Georgian and many other business-name characters are not. Do not promise full names with glyphs 0–2047. New packages should declare needed ranges; generate/distribute font derivatives under their OFL terms without hidden remote font fetches.
For European/global use, add shared, versioned glyph coverage by writing system. Latin/Greek/Cyrillic are broadly covered by current ranges, but Georgian and many other business-name characters are not. Do not promise full names with the bundled ranges; placeholder ranges omit uncovered characters. New packages should declare needed ranges; generate/distribute font derivatives under their OFL terms without hidden remote font fetches.
### Download and install design
+13
View File
@@ -47,3 +47,16 @@ After preserving evidence, restarting the map mode or app while stationary can t
The reviewed code built its debug APK and passed Android lint (zero errors, 76 warnings), 159 unit tests (60 app, 89 core, 10 NaviLite; zero failures or skips), and 17 offline Python tests. The cloud setup uses JDK 17 and Android SDK 36.
These checks do not execute physical MapLibre JNI/OpenGL rendering, Yamaha Bluetooth/TFT behavior, or device power management. They neither reproduce nor rule out this incident. Future fixes need evidence from the device and validation of the affected failure/recovery path.
## Follow-up: persistent history from 13–25 October 2026 (0.13.5)
A shared diagnostic history (100 events, `LOCAL PMTiles`, network connected, GPS recent) showed repeated `SDK/STYLE_READY` failures with `UNKNOWN/UNKNOWN` detail. Each failed in 50–270 ms, well short of the timeout, and recovered after the vehicle moved. Retries reached the 15-second backoff limit and continued for up to 10 minutes. The phone map kept working throughout.
The likely cause is a missing glyph range, which matches this pattern and explains this incident's symptoms:
- `OfflineMapStyle` loads glyphs from `asset://offline/fonts/{fontstack}/{range}.pbf`, but only Unicode ranges 0–2047 were bundled.
- The bundled Asturias archive contains 4,810 label values with U+1E36/U+1E37 (Asturian `Ḷ`/`ḷ`, range 7680–7935). It also contains 124 with typographic quotes and dashes (U+2013, U+2014, U+2018, U+2019; range 8192–8447). These counts come from scanning every tile's `place` and `roads` string values.
- In MapLibre Native 13.5.2, a missing asset produces `Could not read asset` (`AssetManagerFileSource`). `GlyphManager` reports it as a glyph error. `Map::Impl::onResourceError` then fails the pending still image with only that message. The message has no keyword that the diagnostic classifier recognized, which gave `SDK` and `UNKNOWN/UNKNOWN`. The phone's continuous `MapView` only logs the same error, so its map keeps working.
- The failure persists while such a label is in the TFT view and stops once the camera moves away from it.
0.13.7 bundles the unmodified demotiles ranges 7680–7935 and 8192–8447. It also adds an empty placeholder for every other BMP range, so an uncovered character only drops out of a label. A missing asset is now reported as `NOT_FOUND`. Unit tests check that all 256 ranges exist and are well formed, and that the Asturian and punctuation code points are present. The fix still needs to be validated on a device by driving where these failures happened.