From 2fa4a72b2ec8541839586a3671f8bf8d45e66afa Mon Sep 17 00:00:00 2001 From: mindsers Date: Thu, 12 Nov 2026 09:33:36 +0100 Subject: [PATCH] fix(tokens): name the map glyph stacks Unitae Map, not IBM Plex The glyphs are IBM Plex Sans turned into map SDF glyphs. The font's licence (OFL 1.1, Reserved Font Name "Plex") keeps that name for unmodified versions, and glyphs are a modified version, so MAP_FONTS now asks for Unitae Map Regular, Medium and Italic. Same letterforms; the host ships the OFL and IBM's copyright with the glyphs. 0.2.0 is not published yet, so the version stays. --- tokens/README.md | 6 ++++-- tokens/src/map-style.ts | 14 +++++++++----- tokens/test/map-style.test.ts | 6 ++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tokens/README.md b/tokens/README.md index d650202..9bab621 100644 --- a/tokens/README.md +++ b/tokens/README.md @@ -94,8 +94,10 @@ const style = mapStyle({ - Only the pins wear colour: no places, shops, transport, shields, one-way arrows or house numbers (the pins already carry the numbers the lists show). -- Labels use the `MAP_FONTS` glyph stacks (IBM Plex Sans Regular, Medium, Italic); names written in Devanagari ask - for `Noto Sans Devanagari Regular v1`, as Protomaps does. +- Labels use the `MAP_FONTS` glyph stacks, `Unitae Map Regular`, `Medium` and `Italic`: IBM Plex Sans turned into map + glyphs. They carry another name because the font's licence (OFL 1.1) reserves « Plex » for unmodified versions; + serve them with the OFL and IBM's copyright. Names written in Devanagari ask for `Noto Sans Devanagari Regular v1`, + as Protomaps does. - Nothing draws an icon, so the style needs no sprite. - Credit `MAP_ATTRIBUTION` wherever the map shows: OpenStreetMap's licence wants it visible. - The tests check, in both modes, that labels reach 4.5:1 on their halo (the ground), that a pin — primary in a diff --git a/tokens/src/map-style.ts b/tokens/src/map-style.ts index 8120e62..822fbb9 100644 --- a/tokens/src/map-style.ts +++ b/tokens/src/map-style.ts @@ -1,5 +1,5 @@ /** - * The Unitae map style: Protomaps vector tiles painted with the map tokens, labels in IBM Plex. + * The Unitae map style: Protomaps vector tiles painted with the map tokens, labels in IBM Plex letterforms. * * A quiet grey ground for our pins: no places, shops, transport, shields or one-way arrows, and no house numbers — * the pins already carry the numbers the lists show, and a second set of numbers would confuse. Nothing draws an @@ -11,11 +11,15 @@ import { type Flavor, layers } from '@protomaps/basemaps' import { hexColors } from './index.ts' import type { Mode } from './tokens.ts' -/** The glyph font stacks the style asks for. The host serves them under the `glyphs` address. */ +/** + * The glyph font stacks the style asks for; the host serves them under the `glyphs` address. They are IBM Plex Sans + * turned into map glyphs, under another name: the font's licence (OFL 1.1) reserves the name « Plex » for unmodified + * versions, and glyphs are a modified version. Ship the OFL and IBM's copyright with them. + */ export const MAP_FONTS = { - regular: 'IBM Plex Sans Regular', - medium: 'IBM Plex Sans Medium', - italic: 'IBM Plex Sans Italic', + regular: 'Unitae Map Regular', + medium: 'Unitae Map Medium', + italic: 'Unitae Map Italic', } as const /** Who must be credited wherever the map shows: the tiles and the data under them. */ diff --git a/tokens/test/map-style.test.ts b/tokens/test/map-style.test.ts index d3ecf36..20f0370 100644 --- a/tokens/test/map-style.test.ts +++ b/tokens/test/map-style.test.ts @@ -5,6 +5,8 @@ import type { Mode } from '../src/tokens.ts' const modes: Mode[] = ['light', 'dark'] const HEX = /#[0-9a-f]{6}\b/gi +// A font stack named in a layer: « Unitae Map Regular », « Noto Sans Devanagari Regular v1 »… +const FONT_NAME = /"[^"]* (?:Regular|Medium|Italic|Bold)(?: v\d+)?"/g const style = (mode: Mode, lang = 'fr') => mapStyle({ mode, lang, tiles: '/tiles/2026-11/{z}/{x}/{y}.mvt', glyphs: '/map-fonts/{fontstack}/{range}.pbf' }) @@ -73,7 +75,7 @@ describe('mapStyle', () => { expect(ids).toContain('buildings') }) - it('sets every label in IBM Plex (Devanagari names keep the Noto face Protomaps asks for)', () => { + it('sets every label in the map fonts (Devanagari names keep the Noto face Protomaps asks for)', () => { const allowed = new Set([...Object.values(MAP_FONTS), 'Noto Sans Devanagari Regular v1']) const fonts = style('light') .layers.filter((layer) => layer.type === 'symbol') @@ -83,7 +85,7 @@ describe('mapStyle', () => { ('text-font' in layout && layout['text-font']) || [], 'text-field' in layout ? layout['text-field'] : [], ]) - return text.match(/"[^"]*Sans[^"]*"/g) ?? [] + return text.match(FONT_NAME) ?? [] }) .map((quoted) => JSON.parse(quoted) as string) expect(fonts).toContain(MAP_FONTS.regular)