Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions tokens/src/map-style.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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. */
Expand Down
6 changes: 4 additions & 2 deletions tokens/test/map-style.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down
Loading