Skip to content

fix(map): use a fontstack the glyph server actually serves - #229

Merged
bardesss merged 1 commit into
mainfrom
fix/map-glyph-fontstack
Aug 11, 2026
Merged

fix(map): use a fontstack the glyph server actually serves#229
bardesss merged 1 commit into
mainfrom
fix/map-glyph-fontstack

Conversation

@bardesss

Copy link
Copy Markdown
Owner

Problem

Every symbol layer we add ourselves asked for ["Open Sans Bold"]. The glyph server declared in resolveMapStyle's raster fallback does not host that stack:

Open Sans Bold         HTTP 404
Open Sans Regular      HTTP 404
Open Sans Semibold     HTTP 200
Noto Sans Regular      HTTP 200

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_url points at a {z}/{x}/{y} raster template.

Fix

Carto serves Semibold too:

Fontstack demotiles (raster fallback) Carto (default vector)
Open Sans Bold 404 200
Open Sans Semibold 200 200

That makes Semibold the one stack that works against either glyph server. Hoisted to a MAP_FONT constant next to the GLYPHS URL that constrains it — the two must move together — and replaces all four literals (1 in MapView, 3 in RouteMap).

The visible change on the vector path is cluster-count and route-label weight going from Bold to Semibold.

Verification

  • tsc -b clean; 523 tests across 108 files pass (522 before — one added).
  • New test in style.test.ts asserts MAP_FONT is a stack the glyph host actually serves, so this can't silently regress.

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
@bardesss
bardesss merged commit 8548d0d into main Aug 11, 2026
3 checks passed
@bardesss
bardesss deleted the fix/map-glyph-fontstack branch August 11, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant