Skip to content

Add same-origin Fontsource fonts and mapFonts transforms - #15

Merged
pjeweb merged 1 commit into
mainfrom
feat/fontsource-webfont-proxy
Oct 29, 2026
Merged

pjeweb merged 1 commit into
mainfrom
feat/fontsource-webfont-proxy

Conversation

@pjeweb

@pjeweb pjeweb commented Oct 29, 2026

Copy link
Copy Markdown
Member

OpenLayers consumes browser fonts rather than Mapbox PBF glyphs, so proxied styles could still trigger direct jsDelivr requests. Rewritten styles now always supply a same-origin ol:webfonts template. Unconfigured faces return empty CSS and fall back to browser fonts; configured Fontsource families use pinned versions, allow-listed upstream URLs and the existing server cache for CSS/WOFF2 assets.

Add mapFonts for reusing host font names in text-font stacks, literal expressions and formatted-text overrides. Support selected subsets and weight aliases, preserve Unicode ranges and rewrite font sources to local WOFF2 routes. Document configuration, font licenses and client CSS cache invalidation. Keep the changelog entries under Unreleased above the existing 2.6.1 release.

Behavior to review: upstream ol:webfonts metadata is deliberately replaced, including when no fallback faces are configured. Existing external web-font behavior changes to browser fallback until a local face policy is configured.

Validation: 163 tests pass on PHP 8.2.35 and 8.5.4; PHPStan passes. Tests cover local metadata, unknown-face fallback, pinned cached assets, subset rejection, upstream allow-list enforcement, font expression mapping, pinned versions, missing CSS subsets and italic weight aliases. Existing environmental skips and one existing PHPUnit warning remain. No live font download is required by tests.

Prepared for review only; no merge or release of this feature is requested.

@pjeweb
pjeweb merged commit bef9725 into main Oct 29, 2026
6 checks passed
@pjeweb
pjeweb deleted the feat/fontsource-webfont-proxy branch October 29, 2026 22:00
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