Kurz gesagt
Drei Seiten aus einem Schulatlas eines erfundenen Landes. Die Karten sind Gemälde ohne Schrift; alle Namen stehen im Text, sodass eine Übersetzung die Wörter ändert und die Karten lässt, wie sie sind.
Was Sie setzen
Drei Tafeln aus einem Schulatlas von Varenia, einem Land, das für dieses Rezept erfunden wurde. Tafel 1 zeigt seine Lage auf dem Kontinent. Tafel 2 legt die physische Karte über beide Seiten, vom Lira-Meer bis zur Grenze mit Brunavia, in Höhenschichtfarben, mit drei Flüssen und der Linie eines Profils. Tafel 3 zeichnet dieses Profil quer durch das Albar-Gebirge. Jede Tafel beginnt mit einem blauen Band und endet mit einer Legende oder einem Glossar und ein paar Aufgaben für den Unterricht. Die drei Karten sind Gemälde, mit einem Bildmodell erzeugt, und tragen keinen Buchstaben; Grenzen, Städte, der Maßstab und der Nordpfeil sind Vektorsymbole, die mit ihnen gezeichnet sind. Die Profillinie gehört nicht zum Bild: Zwei Konnektoren der Vorlage verbinden zwei Anker der Karte. Alle Namen, Höhen und Zahlen des Maßstabs sind ::label-Zeilen im Markdown, gesetzt an Ankern, die jede Karte mit sich führt, und ebenso die Legende von Tafel 1, die im Meer steht. Deshalb teilen sich die spanische, die englische und die arabische Ausgabe dieselben drei Gemälde, und die arabische wird von rechts gelesen und rechts gebunden.
Dieses Rezept beantwortet
- Wie setze ich die Namen einer Karte aus dem Text, damit eine Übersetzung die Wörter ändert und nicht die Zeichnung?
- Wie lege ich eine Karte über eine Doppelseite und halte ihre Namen in einer Ausgabe von rechts nach links lesbar?
Die kurze Antwort
// A label takes the style its anchor names: seas and rivers in italic blue, ranges in spaced
// brown capitals, towns on a white halo. Arabic is neither slanted nor letter-spaced, and
// Naskh and Kufi set small, so the Arabic edition gets the same styles upright, unspaced and
// 15 % larger.
const [SLANT, TRACK, SIZE] = AR ? ['normal', 0, 1.15] : ['italic', 1, 1];
const halo = { color: col('paper'), width: pt(1.4) };
const style = (id, size, color, more) => ({ id, fontFamily: LABEL, fontSize: pt(size * SIZE),
fontWeight: AR ? 500 : 400, color: col(color), ...more });
const water = (id, size, spacing, more) => style(id, size, 'water', { fontStyle: SLANT,
textTransform: spacing ? 'uppercase' : 'none', letterSpacing: spacing * TRACK, ...more });
const caps = (id, size, color, spacing, more) => style(id, size, color, {
fontWeight: AR ? 700 : 600, textTransform: 'uppercase', letterSpacing: spacing * TRACK,
...more });
const labelStyles = [
water('ocean', 9.5, 0.3), water('sea', 7.5, 0.16), water('river', 6.8, 0, { halo }),
caps('range', 7, 'relief', 0.32, { halo }), caps('region', 6.5, 'muted', 0.24, { halo,
leader: { color: col('ink'), width: pt(0.6), endCap: 'dot', capSize: mm(1.2) } }),
style('legend', 7.6, 'ink', { kind: 'legend', background: col('paper'), padding: mm(2.4),
border: { color: col('muted'), width: pt(0.4) }, radius: mm(1) }),
caps('country', 8.5, 'muted', 0.36, { halo }), caps('nation', 12, 'ink', 0.42, { halo }),
style('capital', 7.6, 'ink', { fontWeight: 700, halo }), style('town', 7, 'ink', { halo }),
style('peak', 6.5, 'ink', { fontWeight: AR ? 700 : 600, halo }),
style('island', 6.5, 'ink', { halo }),
style('point', 8.5, 'band', { fontWeight: 700, halo }), style('tick', 6, 'muted'),
];
// An anchor is a point of the picture in fractions of its width and height, with the side of
// the label that stands there, its turn and its style. km(win) reads a point in km off a map.
const km = (win) => (id, x, y, labelStyle, more) => ({ id, x: (x - win.x0) / (win.x1 - win.x0),
y: (y - win.y0) / (win.y1 - win.y0), style: labelStyle, ...more });
Zutaten
- Funktionen
- Beschriftungen auf dem BildHinweislinien und Legenden an AbbildungenVorlagen für DoppelseitenVerbinder zwischen RahmenZusammengesetzte SeitenRahmen, die in einer Gruppe wachsenFarbfelderText von rechts nach linksRechts gebundene BücherArabische SchriftenAbbildungen und Tabellen als RessourcenEigene RessourcentypenKästenNummerierte ListenAbsatzformateText, Linien und Kästen in SeitengestaltungenGespiegelte RänderSemantische FarbpaletteSeiten auf einem Canvas
- Nutzt außerdem
- An Rahmen verankertes Dekor
- Schrift
- Source Sans 3, Source Serif 4, Noto Naskh Arabic, Noto Kufi Arabic (SIL OFL 1.1)
- Dateien
locator-1776.jpgrelief-1984.jpgsection-1760.jpg- The locator map of Varenia and its neighbours, painted as a physical map with a golden wash over Varenia. (Generated With Diffusion Models, eigener Text)
- The relief map of Varenia across a double page: hypsometric tints, hill shading, coastal shelf, rivers and a lake. (Generated With Diffusion Models, eigener Text)
- The section from A to B painted as a slice of land cut along the line, in the height bands of the map. (Generated With Diffusion Models, eigener Text)
Zubereitung
#1 · Ein Ort ist ein Punkt der Zeichnung
const above = { verticalAlign: 'bottom' }, below = { verticalAlign: 'top' };
const r = km(WIN.relief), l = km(WIN.locator);
const ANCHORS = {
relief: [
r('ocean', 172, 157, 'ocean'), r('lira', 20, 52, 'sea', { rotate: -84 }),
r('gulf', 318, 154, 'sea', { width: 0.07 }), r('nema', 22, 100, 'island', above),
r('albar-range', 98, 108, 'range', { rotate: -33 }),
r('gris-range', 308, 96, 'range', { rotate: -86 }),
r('plateau', 236, 78, 'region'), r('plain', 70, 98, 'region', { width: 0.08 }),
r('sela', 108, 62, 'river', { rotate: -4 }), r('duna', 121, 136, 'river', { rotate: -62 }),
r('merel', 281, 92, 'river', { rotate: -47 }), r('ormo', 254, 104, 'river', above),
// Calvera's name goes below its dot: the River Sela runs in just above it.
...TOWNS.map(([id, x, y]) => (id === 'calvera' ? r(id, x, y + 2.6, 'town', below)
: r(id, x, y - 2.6, id === 'almaren' ? 'capital' : 'town', above))),
...PEAKS.map(([id, x, y]) => r(`${id}-peak`, x, y + 2.4, 'peak', below)),
r('ostelia', 300, 9, 'country'), r('brunavia', 390, 112, 'country', { rotate: -90 }),
r('varenia', 250, 46, 'nation'),
r('a', PROFILE[0][0], PROFILE[0][1] - 2, 'point', above),
r('b', PROFILE[1][0], PROFILE[1][1] + 2, 'point', below),
r('scale-0', SCALE.x, SCALE.y + 3, 'tick', below),
r('scale-25', SCALE.x + 25, SCALE.y + 3, 'tick', below),
r('scale-50', SCALE.x + 50, SCALE.y + 3, 'tick', below),
r('north', NORTH.x, NORTH.y - 8, 'point', above),
r('a-end', ...PROFILE[0]), r('b-end', ...PROFILE[1]),
],
locator: [
l('varenia', 205, 80, 'nation'), l('ostelia', 150, -100, 'country'),
l('brunavia', 560, -120, 'country'), l('lira', 210, -250, 'sea', { rotate: 20 }),
l('ocean', -180, -40, 'ocean', { width: 0.2 }), l('almaren', 259, 127 + 22, 'capital', below),
{ id: 'key', x: 0.115, y: 0.965, style: 'legend', verticalAlign: 'bottom' },
],
// The section: fractions of the drawing, whose plot starts 14 mm in and runs 3 to 51 mm down.
section: (() => {
const [w, h] = MAP.section, x = (u) => (14 + u * (w - 14)) / w;
const y = (m) => (h - 7 - m * (h - 10) / PROFILE_TOP) / h;
return [
{ id: 'a', x: x(0), y: (h - 5.5) / h, style: 'point', ...below },
{ id: 'b', x: x(0.98), y: (h - 5.5) / h, style: 'point', ...below },
...[500, 1000, 1500, 2000].map((m) => ({ id: `m${m}`, x: 7 / w, y: y(m), style: 'tick' })),
{ id: 'sela', x: x(0.3), y: y(40), style: 'region', labelAt: { x: x(0.3), y: y(850) } },
{ id: 'crest', x: x(0.47), y: y(2260), style: 'range', ...above },
{ id: 'plain', x: x(0.82), y: y(160), style: 'region', labelAt: { x: x(0.82), y: y(850) } },
];
})(),
};
Ein Anker ist ein Punkt in Bruchteilen der Breite und Höhe des Bildes. Er gilt also bei jeder Größe, in der der Rahmen die Karte setzt, und wenn die Einpassstufen eine Karte verkleinern, wandern ihre Namen mit. km() rechnet die Kilometer, die man an einem über das Gemälde gelegten Raster abliest, in diese Bruchteile um: Der Punkt einer Stadt und ihr Name kommen beide aus TOWNS und können nicht auseinanderlaufen. Der Anker hält fest, was zum Ort gehört und nicht zur Sprache: sein Stil, die Drehung eines Fluss- oder Gebirgsnamens entlang seines Verlaufs und die Seite der Beschriftung, die am Punkt steht. Stadtnamen stehen mittig über ihrem Punkt, denn align: 'start' wäre bei einem englischen Namen links und bei einem arabischen rechts.
Die Gemälde entstanden der Reihe nach. Zuerst die Reliefkarte, von einem Bildmodell nach einer schattierten Höhenkarte des Landes gemalt; die Lagekarte wurde nach der Reliefkarte gemalt und das Profil nach denselben Höhen, sodass Küsten und Höhen in allen dreien übereinstimmen. Ein über jedes Bild gelegtes Raster lieferte die Kilometer jedes Ankers, und die Grenzen wurden dort gekappt, wo sie die gemalte Küste erreichen.
#2 · Drei Markdown-Dateien, eine Ressource
// A resource has no alt text, caption or note here: each edition's `:::figure` says its own.
const PAINTINGS = { // each plate's painting, a file in assets/, named by its width in pixels
locator: asset('locator-1776.jpg'), relief: asset('relief-1984.jpg'),
section: asset('section-1760.jpg') };
const drawings = { locator: locatorMap, relief: reliefMap, section: profile };
const resources = Object.entries(MAP).map(([id, [w, h]]) => ({ id, typeId: 'map', kind: 'svg',
createdAt: 0, updatedAt: 0, svg: { fileId: `${id}.svg`, width: w * 10, height: h * 10 },
anchors: ANCHORS[id] }));
for (const [id, draw] of Object.entries(drawings)) {
await loadSvg(`${id}.svg`, draw(MAP[id], await dataUrl(PAINTINGS[id])));
}
Die Ressource hat ein Bild (ein SVG, das das Gemälde und darüber die Vektorsymbole enthält) und eine Ankerliste für alle Ausgaben. Jede Ausgabe schreibt je Anker eine Zeile ::label[…]{at="…"} in :::figure{resource="relief" slot="map"}, sodass ::label[Calvera Plain]{at="plain"} und ::label[Llanura de Calvera]{at="plain"} an derselben Stelle stehen und bei Bedarf durch das width des Ankers auf zwei Zeilen umbrochen werden. Auch der Alternativtext ändert sich mit der Ausgabe: Jedes :::figure hat seinen eigenen in einer Zeile ::alt[…], und eine Legende oder eine Notiz stünde ebenso in ::caption[…] und ::note[…]. Ein Anker mit Stil, den eine Ausgabe ohne Beschriftung lässt, meldet anchorUnlabelled; eine Beschriftung, deren at auf keinen Anker verweist, wird nicht gezeichnet und meldet labelAnchorUnknown.
#3 · Eine Tafel und eine Doppeltafel
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const kicker = { kind: 'text', id: 'unit', content: '{attr.unit}', fontFamily: LABEL,
fontSize: pt(AR ? 10 : 8.5), fontWeight: AR ? 500 : 600, letterSpacing: pt(1.3 * TRACK),
textTransform: 'uppercase', color: col('sky'), align: AR ? 'right' : 'left',
// Decoration stands on the sheet: the kicker goes to the side the page starts reading from.
placement: at('container', AR ? 'top-right' : 'top-left', 0, -11) };
const band = { kind: 'box', id: 'band', style: { backgroundColor: col('band') },
placement: { ...at('bleed', 'top-left'), size: { width: 'fill', height: mm(BAND + 3) } } };
const sheet = {
id: 'sheet', header: false, decoration: { elements: [band, kicker] },
frames: [
{ name: 'title', takes: 'h1', placement: at('container', 'top-left', 0, -3) },
{ name: 'text', flow: true, columns: 2, columnGap: mm(7),
placement: at('container', 'top-left', 0, BAND - PAGE.top + 7) },
{ name: 'map' },
{ name: 'key', style: 'key', width: mm(66) },
{ name: 'tasks', style: 'tasks', placement: at('#key', 'right-of', 6) },
],
// A longer text pushes the map and the key down; the map is set smaller before the text is.
groups: [{ name: 'column', kind: 'stack', frames: ['text', 'map', 'key'], gap: mm(6) }],
};
const locator = { id: 'locator', extends: 'sheet', frames: [{ name: 'key', remove: true },
{ name: 'tasks', placement: at('#map', 'below', 0, 6) }],
groups: [{ name: 'column', frames: ['text', 'map'] }] };
// Line A–B: two connectors between two anchors of the map, dotted ends, a see-through paper casing.
const section = (id, color, width, more) => ({ kind: 'connector', id, routing: 'straight',
from: { to: '#map', anchor: 'a-end' }, to: { to: '#map', anchor: 'b-end' }, color: col(color),
width: mm(width), ...more });
const sectionLine = [section('ab-casing', 'paper', 0.9, { opacity: 0.55 }), section('ab-line',
'ink', 0.5, { dash: [mm(1), mm(1)], startCap: 'dot', endCap: 'dot', capSize: mm(2) })];
// The double sheet: one band and one map across both pages, the boxes under the map.
const spread = {
id: 'spread', spread: true, header: false,
decoration: { elements: [band, kicker, ...sectionLine] },
frames: [
{ name: 'title', takes: 'h1', width: mm(177), placement: at('container', 'top-left', 0, -3) },
{ name: 'map', crossGutter: true, // the one frame that runs across the spine
placement: at('container', 'top-left', 0, BAND - PAGE.top + 5) },
{ name: 'text', flow: true, columns: 2, columnGap: mm(7), width: mm(177) },
{ name: 'key', style: 'key', width: mm(72), placement: at('#map', 'below', 213, 6) },
{ name: 'tasks', style: 'tasks', placement: at('#key', 'right-of', 6) },
],
groups: [{ name: 'column', kind: 'stack', frames: ['map', 'text'], gap: mm(6) }],
};
Die Tafel und die Doppeltafel haben dieselben fünf Rahmen, daher hat das Markdown einer Tafel auf einer Seite wie auf zweien dieselbe Form: Titel, der Text ohne Slot, Karte, Legende und Aufgaben. Die Lagetafel erweitert die Tafel (extends) und nimmt den Legendenrahmen heraus (remove: true), denn ihre Legende ist eine Beschriftung der Karte; ihre Aufgaben hängen unter der Karte. Die Profillinie gehört zur Doppeltafel: Zwei connector-Elemente ihrer Dekoration laufen gerade (straight) vom Anker a-end zum Anker b-end des Bildes im Kartenrahmen, eine Papierlinie von 0,9 mm unter einer gestrichelten Tintenlinie von 0,5 mm, mit einem Punkt an jedem Ende. Die Papierlinie hat opacity: 0.55, wie der helle Saum der mit der Karte gezeichneten Grenzen; darunter bleiben die Höhenfarben sichtbar, und die Striche lesen sich auf Grün und Ocker weiterhin. Ein Ende mit anchor folgt dem Bild durch Beschnitt und Skalierung, sodass die Linie auf A und B bleibt, wenn die Einpassstufen die Karte kleiner setzen. Die Dekoration wird unter den Rahmen gemalt, doch ein Konnektor mit einem anchor-Ende zeigt in ein Bild hinein; er wird deshalb über ihnen gemalt, und die Linie ist auf dem Gemälde zu sehen. Auf der Doppeltafel legt spread: true beide Seiten als ein Blatt von 390 mm Breite an, und nur der Kartenrahmen setzt crossGutter: Er läuft über den Bund, während Text und Kästen auf ihrer Seite bleiben. Text, Karte und Legende bilden eine stack-Gruppe; im Belastungstest der Prüfbank, mit allen Texten um 30 % länger, setzt die arabische Ausgabe die Lagekarte auf 87,5 %, und die Kästen darunter rücken nach oben, ohne Warnung.
#4 · Eine Legende auf der Karte und Namen mit Hinweislinien
// A label takes the style its anchor names: seas and rivers in italic blue, ranges in spaced
// brown capitals, towns on a white halo. Arabic is neither slanted nor letter-spaced, and
// Naskh and Kufi set small, so the Arabic edition gets the same styles upright, unspaced and
// 15 % larger.
const [SLANT, TRACK, SIZE] = AR ? ['normal', 0, 1.15] : ['italic', 1, 1];
const halo = { color: col('paper'), width: pt(1.4) };
const style = (id, size, color, more) => ({ id, fontFamily: LABEL, fontSize: pt(size * SIZE),
fontWeight: AR ? 500 : 400, color: col(color), ...more });
const water = (id, size, spacing, more) => style(id, size, 'water', { fontStyle: SLANT,
textTransform: spacing ? 'uppercase' : 'none', letterSpacing: spacing * TRACK, ...more });
const caps = (id, size, color, spacing, more) => style(id, size, color, {
fontWeight: AR ? 700 : 600, textTransform: 'uppercase', letterSpacing: spacing * TRACK,
...more });
const labelStyles = [
water('ocean', 9.5, 0.3), water('sea', 7.5, 0.16), water('river', 6.8, 0, { halo }),
caps('range', 7, 'relief', 0.32, { halo }), caps('region', 6.5, 'muted', 0.24, { halo,
leader: { color: col('ink'), width: pt(0.6), endCap: 'dot', capSize: mm(1.2) } }),
style('legend', 7.6, 'ink', { kind: 'legend', background: col('paper'), padding: mm(2.4),
border: { color: col('muted'), width: pt(0.4) }, radius: mm(1) }),
caps('country', 8.5, 'muted', 0.36, { halo }), caps('nation', 12, 'ink', 0.42, { halo }),
style('capital', 7.6, 'ink', { fontWeight: 700, halo }), style('town', 7, 'ink', { halo }),
style('peak', 6.5, 'ink', { fontWeight: AR ? 700 : 600, halo }),
style('island', 6.5, 'ink', { halo }),
style('point', 8.5, 'band', { fontWeight: 700, halo }), style('tick', 6, 'muted'),
];
// An anchor is a point of the picture in fractions of its width and height, with the side of
// the label that stands there, its turn and its style. km(win) reads a point in km off a map.
const km = (win) => (id, x, y, labelStyle, more) => ({ id, x: (x - win.x0) / (win.x1 - win.x0),
y: (y - win.y0) / (win.y1 - win.y0), style: labelStyle, ...more });
Der Stil legend ist eine Beschriftung mit kind: 'legend', einer weißen Platte, einer Haarlinie als Rand und runden Ecken. Sein Markdown ist ein Block :::label{at="key" style="legend"} in der Abbildung, eine Zeile je Eintrag: :icon[]{resource="key-mark" color="country"} Varenia färbt eine kleine quadratische Ressource mit einer Farbe der Palette, :icon[]{line="dashed" color="border"} zeichnet ein Muster der Grenze, und die Symbole am Zeilenanfang stehen in einer Spalte, sodass die Wörter rechts davon fluchten, im Arabischen links. Die eckigen Klammern bleiben leer: Das folgende Wort benennt die Zeile, und ein Symbol ohne Alternativtext gilt als Schmuck. Im Profil stehen die Anker sela und plain auf dem Boden, und ihr labelAt setzt die Namen 850 m hoch in den Himmel; der leader des Stils region zieht eine Linie von 0,6 pt mit einem Punkt von jedem Namen hinunter zu seiner Stelle.
#5 · Eine Palette für Seite, Höhenfarben und Legende
const palette = {
ink: '#1f2a2e', paper: '#ffffff', muted: '#55646a',
band: '#1d5f73', // the accent: the head of each sheet, box stripes, list numbers
sky: '#d4e9f2', // the kicker on the band
tint: '#eef2ef', // the key's box
water: '#0b2a47', sea: '#8ec5e9', // the names of water, and the sea of the key
// The key's tints are the median colours of the painted relief at each height band.
low: '#aec67f', hill: '#ced285', upland: '#efce80', mount: '#d79c61', peak: '#b5734b',
relief: '#5a3519', // the names of ranges
land: '#e1dfbe', country: '#ebcb73', border: '#8a3b52', // the locator map's washes and border
};
// col(id) links a colour to its palette entry; the vector symbols read the same hex from `palette`.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.band }) // the defaults' id
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
Die fünf Höhenschichtfarben sind Einträge der Palette (palette.low bis palette.peak), eingestellt auf die mittlere Farbe des gemalten Reliefs in jeder Schicht, und die Legende von Tafel 2 schreibt :swatch{color="low"} mit denselben Kennungen. Das Gemälde übernimmt die Palette nicht: Ein neuer Hexwert ändert die Legende und die Vektorsymbole und lässt das Bild, wie es ist; um die Farben der Karte zu ändern, muss man sie neu malen. Die Gewässernamen in water haben auf dem gemalten Meer einen Kontrast von mindestens 6:1, der weiße Titel auf band 7,2:1.
#6 · Die arabische Ausgabe
Der Code steht in der kurzen Antwort oben. locale: 'ar' setzt den Text von rechts nach links und bindet das Buch rechts, sodass die Doppelseite auf der rechten Seite beginnt und die Rahmen dem gespiegelten Satzspiegel folgen: Titel und Text stehen rechts, die Legende rechts neben den Aufgaben. Die Karten werden nicht gespiegelt, und jeder arabische Name steht dort, wo sein Ort gezeichnet ist. Im Arabischen verlieren die Beschriftungsstile Kursive und Sperrung und werden um 15 % größer, weil das Kufi klein läuft. Dekoration und Paginierung bleiben auf dem Blatt, also wandert die Dachzeile nach rechts oben und die Seitenzahlen wechseln die Seite.
Das ganze Rezept
// ═══ Postext Cookbook · Nº 157 · A school atlas labelled from the Markdown ═══════
// https://postext.dev/en/cookbook/school-atlas-labelled-maps
// Code: MIT · Text: original (CC BY 4.0) · Maps: painted with diffusion models, symbols set in code
// Fonts: Source Sans 3, Source Serif 4, Noto Naskh and Kufi Arabic (OFL) · Needs postext ≥ 1.49.0
//
// Three pages of a school atlas of Varenia, an invented country: a locator map, the relief map
// across a double page and a section through the mountains. The maps are painted without a letter.
// Every name on them is a ::label in content.<lang>.md, standing at an anchor of the resource,
// so the Spanish, English and Arabic editions share the same paintings and the same anchors.
import {
buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('es' | 'en' | 'ar')
const RECIPE = 'school-atlas-labelled-maps';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the page's colours and the key's tints, one object for both
const palette = {
ink: '#1f2a2e', paper: '#ffffff', muted: '#55646a',
band: '#1d5f73', // the accent: the head of each sheet, box stripes, list numbers
sky: '#d4e9f2', // the kicker on the band
tint: '#eef2ef', // the key's box
water: '#0b2a47', sea: '#8ec5e9', // the names of water, and the sea of the key
// The key's tints are the median colours of the painted relief at each height band.
low: '#aec67f', hill: '#ced285', upland: '#efce80', mount: '#d79c61', peak: '#b5734b',
relief: '#5a3519', // the names of ranges
land: '#e1dfbe', country: '#ebcb73', border: '#8a3b52', // the locator map's washes and border
};
// col(id) links a colour to its palette entry; the vector symbols read the same hex from `palette`.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.band }) // the defaults' id
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const AR = LANG === 'ar';
// Three voices per script: a text face, a display face and the face of the map labels.
const [TEXT, DISPLAY, LABEL] = AR ? ['Noto Naskh Arabic', 'Noto Kufi Arabic', 'Noto Kufi Arabic']
: ['Source Sans 3', 'Source Serif 4', 'Source Sans 3'];
const PAGE = { w: 210, h: 280, top: 22, bottom: 20, inner: 18, outer: 15 }; // mm, mirrored
const BAND = 44; // mm from the trim to the foot of the band at the head of a sheet
// #region answer: label styles in the config, label fields on the anchors of a resource
// A label takes the style its anchor names: seas and rivers in italic blue, ranges in spaced
// brown capitals, towns on a white halo. Arabic is neither slanted nor letter-spaced, and
// Naskh and Kufi set small, so the Arabic edition gets the same styles upright, unspaced and
// 15 % larger.
const [SLANT, TRACK, SIZE] = AR ? ['normal', 0, 1.15] : ['italic', 1, 1];
const halo = { color: col('paper'), width: pt(1.4) };
Das zusammengesetzte script.js läuft unverändert: Fügen Sie es in das Modulskript einer beliebigen Seite ein, oder öffnen Sie das Rezept auf CodePen. Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)
Varianten
#Einen Ort ohne Anker benennen
Eine Beschriftung kann an einem Punkt stehen, der in Prozent des Bildes angegeben ist, mit einem eigenen Stil.
:::figure{resource="relief" slot="map"}
+::label[Nema Light]{at="7% 68%" style="town"}
::label[Misty Ocean]{at="ocean"}#Die Karten nummerieren und beschriften
Geben Sie dem Kartentyp einen Zähler und ein Präfix und jeder Ressource eine Legende: siehe das Atlasblatt mit nummerierten Karten, das seine Legenden auf einen blauen Balken setzt.
Häufige Fehler
Layoutwarnung · labelAnchorUnknown
Beschriftung an einem unbekannten Anker
Ursache. Ein ::label einer :::figure verweist mit at= auf einen Anker, den die Ressource der Abbildung nicht hat. Die Beschriftung wird nicht auf das Bild gezeichnet; das umfließende EPUB führt sie weiter auf, und der Alternativtext des Bildes erwähnt sie.
Lösung. Korrigieren Sie die Anker-ID in at= (die Warnung listet die Anker der Ressource), legen Sie den Anker in der Ressource an oder setzen Sie die Beschriftung mit at="x% y%". Doku →
Layoutwarnung · anchorUnlabelled
Anker ohne Beschriftung
Ursache. Ein Anker der Ressource einer Abbildung hat einen Beschriftungsstil, und in dieser Sprache steht dort kein ::label der Abbildung: Dieser Ausgabe fehlt das Wort, für das die Karte Platz hat. Ein Hinweis, kein Fehler; Anker ohne Stil (etwa der eines Sprechers im Comic) werden nicht gemeldet.
Lösung. Schreiben Sie die Beschriftung in das Markdown dieser Sprache (::label[…]{at="anker"}), oder nehmen Sie dem Anker den Stil, wenn diese Ausgabe das Wort weglässt. Doku →
- Der Alternativtext jeder Karte steht im Markdown, als Zeile
::alt[…]in ihrem:::figure, eine je Ausgabe. Eine Abbildung, die keinen angibt, behält denaltTextder Ressource selbst;script.jsenthält kein Wort der Seite. - Ein Konnektor, dessen Enden nur Rahmen nennen, wird mit der übrigen Dekoration unter ihnen gemalt; erst ein Ende mit
anchorhebt ihn über das Bild. Eine Linie von einer Notiz zum Kartenrand, ohne Anker, ist dort verdeckt, wo sie das Gemälde kreuzt. - Die Anker und die Vektorsymbole (Grenzen, Städte, Gipfel, die Enden der Profillinie) stehen an Kilometern, die am Gemälde abgelesen wurden. Wird eine Karte neu gemalt, verschieben sich ihre Küsten, Flüsse und Kämme: Legen Sie das Raster über das neue Bild und lesen Sie sie neu ab, sonst steht ein Name im Meer.
- Auf einer Seite von rechts nach links folgen die Rahmen dem gespiegelten Satzspiegel, die Dekoration der Vorlage aber nicht: Platzieren Sie die Dachzeile je Ausgabe, wie es
kickertut. - Ein zweispaltiger Rahmen kann einen Absatz eine Zeile vor seinem Ende trennen und diese Zeile oben in die zweite Spalte stellen. Prüfen Sie die Spalten jeder Ausgabe und verschieben Sie dann einen Satz in den nächsten Absatz.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- Eigener Text, CC BY 4.0
- Bilder
- The locator map of Varenia and its neighbours, painted as a physical map with a golden wash over Varenia. · Generated With Diffusion Models · eigener Text
- The relief map of Varenia across a double page: hypsometric tints, hill shading, coastal shelf, rivers and a lake. · Generated With Diffusion Models · eigener Text
- The section from A to B painted as a slice of land cut along the line, in the height bands of the map. · Generated With Diffusion Models · eigener Text
- Schriften
- Source Sans 3 (SIL OFL 1.1) · Source Serif 4 (SIL OFL 1.1) · Noto Naskh Arabic (SIL OFL 1.1) · Noto Kufi Arabic (SIL OFL 1.1)
- Code
- MIT, wie Postext
Diesen Text bearbeiten ↗ (öffnet sich in einem neuen Tab)Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)


