Skip to main content

Custom protocol glyph services

Common setGlyphs accepts HTTP(S) or validated hierarchical custom templates; customGlyphResourceURLs is true. The API remains MapLibre-shaped, with null/empty string clearing the service. Hosts supply handlers. The complete ordered text-font stack stays encoded as one path component, and each range covers256 code points.

map.setGlyphs('memory://assets/fonts/{fontstack}/{range}.pbf');
await map.sqs.flush();

Each placeholder appears exactly once. Hosts cannot contain placeholders; unknown tokens, credentials, fragments, whitespace/control characters and reserved file/data/blob/ws schemes remain invalid. The4096-byte template and PBF/cache/atlas/text budgets are unchanged. Failed validation retains the service; replacement/clearing cancels old generations, isolates late replies and refreshes atlas/collision/query state.

Browser hosts install addProtocol in the map realm or independently in a Worker and deliver encoded PBF bytes. Native C callers consume Glyphs requests and reply using the original generation/id. Custom requests retain shared deadlines/byte/cancellation planning, with no automatic HTTP retry/fallback. Libraries contain no downloader; desktop custom transport, native JS callbacks and cross-Worker function forwarding remain pending.

Run the identical seven-check script andcomplete HTML/Worker/handler inside the matching SDK directory. The PBF contains a generated8×8 solid A, not a third-party font. Native/main-thread/Worker requests retain the encoded complete font stack. Pixel checks require a small solid rectangle so fallback A contours cannot pass as external glyph decoding. Delivery must be followed by actual decoding/repainting; flush write confirmation does not imply arrival.

Seeexternal glyphs for metrics/licenses/budgets andshared planning for handler conditions. Complex/bidi/line shaping, native JS registration, mobile GIS/iOS/devices/external systems and formal releases remain separate tasks.

After glyph decoding updates a cache inside a frame, WASM requests the next frame and native resource state reports repaint work. Idle waits for common symbol-cache synchronization. Acceptance does not move the camera or force an extra redraw, checking automatic updates after resource arrival.