In breve
Un piccolo libro di tre lettere tra il re di Prussia e Voltaire. Mostra come comporre la data, il saluto e la firma di ogni lettera, con le lettere che si susseguono senza pagine nuove.
Che cosa comporrai
Cinque pagine di Mon sort est changé, un’edizione di 14 × 21 cm di tre lettere in francese: le due che Federico II scrisse a Voltaire sei e dodici giorni dopo essere diventato re di Prussia, nel giugno 1740, e la lettera di Voltaire del 1º aprile 1778, due mesi prima della sua morte. In copertina, una fotografia di due lettere piegate e di un sigillo di ceralacca rossa, generata con modelli di diffusione, poggia su un marocchino verde disegnato in codice e racchiuso in un doppio filetto dorato. All’interno, le lettere si susseguono senza interruzioni di pagina. Ogni intestazione dà il numero in maiuscoletto rosso e i due corrispondenti in corsivo Fell, con luogo e data allineati a destra sotto di loro. Il saluto ha una riga propria, e la firma, in maiuscoletto, chiude la lettera al margine destro; il poscritto di Federico segue la sua firma un corpo più piccolo. La testatina di ogni recto dà la data della lettera.
Questa ricetta risponde a
- Come compongo un’epigrafe, una dedica, una firma o una citazione in evidenza con una grande virgoletta?
- Come ottengo una buona giustificazione e sillabazione per testi in spagnolo, francese o tedesco?
- Come imposto le testatine: titolo del libro sulla pagina sinistra, titolo del capitolo sulla destra, numero di pagina all’esterno?
La risposta breve
// Each letter is a level-1 heading that carries its place and date as attributes:
// # Frédéric à Voltaire {place="À Charlottembourg" date="6 juin 1740"}
// (a value holds no { or }, and one with " goes in single quotes: gotcha attr-values)
const letterHead = { enabled: true, slot: { elements: [
// {number} prints the count as numberingTemplate '{1:I}' writes it.
{ kind: 'text', id: 'number', content: 'Lettre {number}', ...sc, fontSize: pt(9),
letterSpacing: pt(1.8), color: col('seal'), placement: at('container', 'top-left') },
{ kind: 'text', id: 'title', content: '{titleText}', ...fell, fontSize: pt(15),
color: col('ink'),
placement: at('#number', 'below', 0, 1) },
// The dateline spans the measure under the title and sets its words flush right;
// inlineMarks reads the attribute's marks, so date="1^er^ avril 1778" raises its ordinal.
{ kind: 'text', id: 'dateline', content: '{attr.place}, le {attr.date}.', ...crimson,
italic: true, fontSize: pt(10.4), color: col('ink'), align: 'right', inlineMarks: true,
placement: { ...at('#title', 'below', 0, 1.5), size: { width: 'fill' } } },
] } };
// The salutation, the signature and the postscript, each a :::paragraphs{style="…"} container:
// :::paragraphs{style="signature"}
// Fédéric.
// :::
const letterParts = [
{ id: 'vedette', firstLineIndent: pt(0) }, // 'Sire,' on a line of its own, flush left
{ id: 'signature', ...sc, fontSize: pt(10.5), textAlign: 'right', marginTop: pt(LEAD / 2) },
{ id: 'postscript', fontSize: pt(9), lineHeight: pt(12.6), marginTop: pt(LEAD / 2) },
];
// Hooked up below: letterHead designs the level-1 heading, letterParts joins paragraphStyles.
Ingredienti
- Funzionalità
- Attributi dei titoliAncoraggio degli elementi del progettoStili di paragrafoAperture progettateTitoli numeratiCapitoli che si aprono su un rectoStili di titoloCopertine, frontespizi e colophonImmagini nei progetti di paginaA capo nei titoliTestatine e folioVersi riga per rigaMargini speculariColore della cartaSillabazione e lingua del documentoApici e pediciMetadati del documentoTavolozza di colori semanticaPagine su un canvas
- Tipo
- Crimson Pro, IM Fell French Canon, IM Fell DW Pica SC (SIL OFL 1.1)
- Risorse
letters-1160.jpg- The cover: two folded letters and a wax seal, a photograph (Generated With Diffusion Models, originale)
- The cover’s green morocco and gilt fillet, drawn in code (Ignacio Ferro, CC BY 4.0)
Preparazione
#1 · Leggi la data topica dal titolo
Il codice è nella risposta breve qui sopra. Ogni lettera è un titolo di livello 1 i cui attributi contengono luogo e data, e l’intestazione li stampa come {attr.place}, le {attr.date}. (attributi del titolo). Il riquadro della data topica arriva al bordo destro della colonna (width: 'fill'), e align: 'right' allinea le parole a quel bordo; senza di esso, il testo dei titoli grafici è centrato. Il saluto, la firma e il poscritto sono stili di paragrafo applicati con :::paragraphs{style="…"}. La firma usa IM Fell DW Pica SC, una famiglia le cui minuscole sono disegnate come maiuscoletto. inlineMarks: true fa leggere alla data topica i segni nel suo attributo, così date="1^er^ avril 1778" mette in esponente l’ordinale.
#2 · Fai susseguire le lettere
const letters = { level: 1, numberingTemplate: '{1:I}', advancedDesign: letterHead,
// No break: left at the level's default, each letter would open on a recto.
breakBefore: { enabled: false }, marginTop: pt(2 * LEAD),
// The hidden heading line is measured in the heading face: italic keeps it the IM Fell cut
// that FONTS loads. Upright, it would need the roman, which FONTS
// leaves out; the layout would change only for a title long enough to wrap.
italic: true };
Con breakBefore disattivato, una lettera comincia due linee di griglia (marginTop) sotto la linea di griglia dove finisce la precedente. A pagina 4 il poscritto, composto su un’interlinea di 12,6 pt, finisce tra due linee di griglia, così sopra la lettera III restano circa tre righe di bianco. A pagina 2, la lettera I arriva al piede della pagina e la lettera II apre la pagina 3. Lasciato al suo valore predefinito, il livello 1 aprirebbe ogni lettera su un recto (interruzione prima). numberingTemplate: '{1:I}' numera le lettere da I a III, e l’intestazione stampa il numero romano tramite {number}.
#3 · Data il recto con la lettera
const HEAD_Y = 12; // mm from the top edge
const head = (id, content, parity, placement, look = {}) => ({ kind: 'text', id, content,
parity, pages: 'body', ...sc, fontSize: pt(8.5), letterSpacing: pt(0.9), color: col('muted'),
placement, ...look });
const folio = { ...crimson, fontSize: pt(9), letterSpacing: pt(0), color: col('ink') };
const header = { elements: [
head('verso-folio', '{pageNumber}', 'even', at('page', 'top-left', MARGIN.outer, HEAD_Y), folio),
head('verso-names', '{author}', 'even', at('page', 'top-left', MARGIN.outer + 8, HEAD_Y)),
// {attr.date} reads the last letter that starts on or before the page.
head('recto-date', '{attr.date}', 'odd', at('page', 'top-right', -(MARGIN.outer + 8), HEAD_Y),
{ ...crimson, italic: true, fontSize: pt(9.5), letterSpacing: pt(0), inlineMarks: true }),
head('recto-folio', '{pageNumber}', 'odd', at('page', 'top-right', -MARGIN.outer, HEAD_Y),
folio),
] };
In un’intestazione di pagina, {attr.date} prende l’attributo dell’ultimo titolo di livello 1 che comincia su quella pagina o prima. La pagina 3 stampa «12 juin 1740», e la pagina 5, dove continua la lettera di Voltaire cominciata a pagina 4, stampa «1er avril 1778» con l’ordinale in esponente (elementi di testo). Le testatine stanno 12 mm sotto il bordo superiore della pagina, il numero di pagina sul margine esterno e le parole 8 mm più all’interno. pages: 'body' le tiene fuori dalla copertina, che conta come apertura perché il suo titolo occupa tutta la pagina. La data è composta nel corsivo Crimson Pro della data topica che ripete, e i nomi sul verso nel maiuscoletto dei numeri delle lettere.
#4 · Fai della copertina un titolo
// The Markdown: # Mon sort \\ est changé {style="cover"}. The binding fills the page, so the
// design reserves all of it and the headnote starts on page 2.
const onCover = (y) => at('page', 'top', 0, y); // centred, y mm below the top edge
const LETTERS = { x: 12, y: 72, w: 116, h: 120 }; // mm: the photograph, inside the fillet
// numbered: false keeps the cover out of the count, so the first letter is I.
const cover = { id: 'cover', numbered: false,
// span: 'page' although the book has one column. Kept in the column, the design stops at
// the column's foot (a band of paper under the leather), and page 1 counts as a 'body' page
// and prints the running heads.
span: 'page', advancedDesign: { enabled: true, slot: { elements: [
{ kind: 'image', id: 'binding', resourceId: 'binding',
placement: { ...at('bleed', 'top-left'), size: { width: 'fill', height: 'fill' } } },
{ kind: 'image', id: 'letters', resourceId: 'letters', placement: { ...at('page', 'top-left',
LETTERS.x, LETTERS.y), size: { width: mm(LETTERS.w), height: mm(LETTERS.h) } } },
{ kind: 'text', id: 'names', content: '{author}', ...sc, fontSize: pt(9.5),
letterSpacing: pt(2), color: col('gilt'), placement: onCover(18) },
// \\ in the heading breaks the title here.
{ kind: 'text', id: 'title', content: '{titleText}', ...fell, fontSize: pt(50),
lineHeight: 1, color: col('paper'), align: 'center', overflow: 'wrap',
placement: onCover(24) },
{ kind: 'text', id: 'subtitle', content: '{subtitle}', ...crimson, italic: true,
fontSize: pt(12), color: col('paper'), placement: onCover(62) },
] } } };
La copertina è il primo titolo, nello stile di titolo cover: un elemento immagine ancorato all’abbondanza contiene la legatura disegnata, un secondo colloca la fotografia 72 mm più in basso, e il titolo, i nomi e il sottotitolo vengono dal titolo e dal front matter. numbered: false la esclude dal conteggio, così la prima lettera di Federico è la I. L’immagine della legatura riempie la pagina, e un’apertura riserva spazio fino al suo elemento più basso, quindi la copertina occupa tutta la pagina 1 e la nota introduttiva comincia a pagina 2 senza :::pagebreak.
#5 · Sillaba il francese e tieni aperti gli spazi
// Justification, hyphenation, whole-paragraph line breaking and the widow, orphan and runt
// rules are defaults; locale 'fr' (in the config) picks the French patterns.
// The letters keep the transcription's unspaced ; : ? and !; a narrow no-break space
// (U+202F) typed before each would give French spacing and never end a line.
const bodyText = { fontFamily: 'Crimson Pro', fontSize: pt(10), lineHeight: pt(LEAD),
color: col('ink'), firstLineIndent: mm(5),
// No :ref here: written out with the other colours, for the default-skin check.
referenceColor: col('ink'),
// A word space never shrinks below 75 % of the font's. At the default 60 %, the tightest
// line on page 5 sets its spaces at 0.70 (each VDT line carries its justifiedSpaceRatio).
minWordSpacing: 0.75 };
locale: 'fr' sillaba con i pattern francesi (ou-vrage a pagina 2, représen-tation a pagina 4). La giustificazione, la divisione in righe sull’intero paragrafo e le regole su vedove, orfane e righe finali troppo corte sono attive per impostazione predefinita. minWordSpacing: 0.75 impedisce a uno spazio tra parole di restringersi sotto i tre quarti di quello di Crimson Pro; con il valore predefinito 0.6, la riga giustificata più stretta di pagina 5 avrebbe gli spazi a 0,70 di quella larghezza. Con un’interlinea di 14,4 pt la pagina contiene 33 righe, e il margine inferiore è ciò che resta sotto di esse, 20,4 mm.
#6 · Collega ogni colore alla palette
const palette = {
ink: '#2a2320', // the text: a warm near-black
paper: '#f6efe2', // the page, and the lettering on the cover
seal: '#9c2b24', // the letter numbers
leather: '#2a4536', // the cover: a green morocco binding
gilt: '#d0b67c', // its tooled border and the names on it
muted: '#75695d', // the running heads
};
// col(id): a colour linked to its palette entry, in text styles and design elements alike.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
// The engine's default colours, the italic of the headnote among them, link to 'main-color';
// here it is the ink, not the default blue.
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
col() collega ogni colore alla sua voce della tavolozza, e il collegamento vale allo stesso modo negli stili del testo e negli elementi grafici: le intestazioni delle lettere, le testatine e la copertina. Il corsivo della nota introduttiva e del colophon prende il colore predefinito del corsivo, collegato a main-color; con quella voce impostata sull’inchiostro, si stampa in nero e non nel blu del motore, #295AA3.
La ricetta completa
// ═══ Postext Cookbook · Nº 064 · Letters edition: datelines and signatures ════════════
// https://postext.dev/en/cookbook/letters-edition
// Code: MIT · Text: Frederick II and Voltaire, 1740 and 1778 (PD) · Cover photo: diffusion models
// Fonts: Crimson Pro, IM Fell French Canon, IM Fell DW Pica SC (SIL OFL) · Needs postext ≥ 1.25.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'letters-edition';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: iron-gall ink on cream paper, wax red, green morocco and gilt
const palette = {
ink: '#2a2320', // the text: a warm near-black
paper: '#f6efe2', // the page, and the lettering on the cover
seal: '#9c2b24', // the letter numbers
leather: '#2a4536', // the cover: a green morocco binding
gilt: '#d0b67c', // its tooled border and the names on it
muted: '#75695d', // the running heads
};
// col(id): a colour linked to its palette entry, in text styles and design elements alike.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
// The engine's default colours, the italic of the headnote among them, link to 'main-color';
// here it is the ink, not the default blue.
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion
const TRIM = { width: 140, height: 210 }; // the French 14 × 21 format
const LEAD = 14.4; // pt: the body's leading, the grid every letter starts on
const LINES = 33; // lines of text on a full page
const TOP = 22; // mm: the top margin
const MARGIN = { top: TOP, inner: 17.5, outer: 14.5, // mm, mirrored
bottom: TRIM.height - TOP - (LINES * LEAD * 25.4) / 72 }; // ends the page on line 33
const sc = { fontFamily: 'IM Fell DW Pica SC' }; // its lower case is cut as small capitals
const fell = { fontFamily: 'IM Fell French Canon', italic: true }; // the display italic
const crimson = { fontFamily: 'Crimson Pro' }; // the text face
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
// #region answer: a letter head read from the heading, and styles for the letter's parts
// Each letter is a level-1 heading that carries its place and date as attributes:
// # Frédéric à Voltaire {place="À Charlottembourg" date="6 juin 1740"}
// (a value holds no { or }, and one with " goes in single quotes: gotcha attr-values)
const letterHead = { enabled: true, slot: { elements: [
// {number} prints the count as numberingTemplate '{1:I}' writes it.
{ kind: 'text', id: 'number', content: 'Lettre {number}', ...sc, fontSize: pt(9),
Lo script.js composto funziona così com’è: incollalo nello script modulo di qualsiasi pagina, oppure apri la ricetta su CodePen. Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)
Varianti
#Nomina il luogo nella testatina
Gli stessi attributi possono dare al recto l’intera data topica, À Charlottembourg, le 12 juin 1740.
- head('recto-date', '{attr.date}', 'odd', at('page', 'top-right', -(MARGIN.outer + 8), HEAD_Y),
+ head('recto-date', '{attr.place}, le {attr.date}', 'odd',
+ at('page', 'top-right', -(MARGIN.outer + 8), HEAD_Y),Errori frequenti
Errore frequente
Valori degli attributi: niente { o }; virgolette semplici per un valore con "
Il valore di un attributo finisce alla graffa di chiusura, quindi non può contenere { o }. Un valore che contiene una virgoletta doppia va tra virgolette semplici; il simbolo del dollaro va bene. Attributi dei titoli →
- Il recto prende la data dell’ultima lettera che comincia su quella pagina o prima. Una pagina che chiude una lettera e apre la successiva riporta la data della lettera nuova, come la testatina di un dizionario riporta l’ultima voce della pagina.
- Un titolo senza l’attributo stampa una stringa vuota, senza avvisi: una lettera senza
place="…"riceve una data topica che comincia con una virgola. Controlla il titolo di ogni lettera. - Le lettere conservano i ; : ? e ! senza spazio della trascrizione. L’uso francese mette prima di essi uno spazio stretto indivisibile (U+202F); digitato lì, tiene ogni segno sulla riga della sua parola.
- Crimson Pro non ha le lettere modificatrici ᵉ (U+1D49) né ʳ (U+02B3), quindi 1ᵉʳ scritto in Unicode si stamperebbe in un font di riserva. Scrivi invece
1^er^: la nota introduttiva, che è testo corrente, lo compone in esponente, e così fanno la data topica e la testatina del recto, i cui elementi di testo hannoinlineMarks: true.
Crediti
- Ricetta
- Ignacio Ferro
- Testo
- Frederick II’s letters to Voltaire of 6 and 12 June 1740 and Voltaire’s letter to him of 1 April 1778, in Correspondance de Voltaire avec le roi de Prusse (Paris, Librairie de la Bibliothèque nationale, 1889), one misprint corrected (ouvragés), the salutations and signatures set apart · Frédéric II · Voltaire · pubblico dominio
- The headnote and the colophon · Ignacio Ferro · CC BY 4.0
- Immagini
- The cover: two folded letters and a wax seal, a photograph · Generated With Diffusion Models · originale
- The cover’s green morocco and gilt fillet, drawn in code · Ignacio Ferro · CC BY 4.0
- Font
- Crimson Pro (SIL OFL 1.1) · IM Fell French Canon (SIL OFL 1.1) · IM Fell DW Pica SC (SIL OFL 1.1)
- Codice
- MIT, come Postext
Modifica questo testo ↗ (si apre in una nuova scheda)Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)


