fix(map): use a fontstack the glyph server actually serves - #229
Merged
Conversation
Every symbol layer we add ourselves asked for "Open Sans Bold". The glyph
server declared in resolveMapStyle's raster fallback
(demotiles.maplibre.org) does not host that stack — it serves only "Open
Sans Semibold" and "Noto Sans Regular" — so the glyph request 404s and
the labels never render: cluster counts on the main map, and node
numbers plus start/end markers on the route map.
Only the raster path was affected. The default Carto vector style brings
its own glyph server, which does serve Bold, so the labels rendered
there and the breakage was invisible unless map_tile_url pointed at a
{z}/{x}/{y} raster template.
Carto serves Semibold as well, making it the one stack that works
against either glyph server. Hoist it to a MAP_FONT constant next to the
GLYPHS URL that constrains it, so the two can't drift apart, and cover
the invariant with a test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C9kFa8hXvo2WhgNDBZu6yM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every symbol layer we add ourselves asked for
["Open Sans Bold"]. The glyph server declared inresolveMapStyle's raster fallback does not host that stack:So the glyph request 404s and the labels never render — cluster counts on the main map, and node numbers plus start/end markers on the route map.
Only the raster path is affected. The default Carto vector style ships its own glyph server, which does serve Bold, so labels render there and the breakage is invisible unless
map_tile_urlpoints at a{z}/{x}/{y}raster template.Fix
Carto serves Semibold too:
That makes Semibold the one stack that works against either glyph server. Hoisted to a
MAP_FONTconstant next to theGLYPHSURL that constrains it — the two must move together — and replaces all four literals (1 inMapView, 3 inRouteMap).The visible change on the vector path is cluster-count and route-label weight going from Bold to Semibold.
Verification
tsc -bclean; 523 tests across 108 files pass (522 before — one added).style.test.tsassertsMAP_FONTis a stack the glyph host actually serves, so this can't silently regress.