In breve
Il primo capitolo di un romanzo greco del 1914, composto come un piccolo tascabile. Le parole vanno a capo come insegna la grammatica scolastica greca, e le testatine sono in maiuscolo, che in greco non porta accenti.
Che cosa comporrai
Il primo capitolo di Η τιμή και το χρήμα (L’onore e il denaro, 1914) di Konstantinos Theotokis, preso dalla Wikisource greca, in un libro di 13,5 × 20,5 cm. Lo precedono un frontespizio e una nota sul testo; il capitolo si apre su pagina dispari sotto il suo numero, Αʹ, in GFS Didot, abbassato di dieci righe. Il testo è Literata 9,7 su 14,2 pt, 31 righe per pagina, giustificato e sillabato con gli schemi del greco monotonico. Le testatine portano l’autore sulle pagine pari e il titolo sulle dispari, in maiuscole spaziate che perdono l’accento, come vogliono le maiuscole greche. La nota e il colophon seguono la lingua dell’edizione; il romanzo resta greco in tutte e tre.
Questa ricetta risponde a
- 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?
- Come scrivo trattini di dialogo, anni a inizio paragrafo, prezzi e simboli letterali senza che il Markdown li interpreti male?
La risposta breve
// locale 'el' picks the monotonic patterns, which keep the digraphs and the diphthongs
// whole (μπρά-τσα, ευ-τυ-χί-α) and divide between two consonants the way a Greek school
// grammar does (κάρ-βου-να, αν-θρώ-πους). The same tag gives the Greek labels and tags the
// PDF as Greek. The defaults justify, hyphenate in config().locale and break by Knuth–Plass.
const LOCALE = 'el';
const bodyText = { // config().bodyText
fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
firstLineIndent: em(1.2), indentAfterHeading: false,
// Two letters at least on either side of a break (ξα-νά, not ξ-ανά) and no page that ends
// on a divided word. Greek words run long: spaces from 0.8× to 1.6× of the face's own,
// then up to 12‰ of tracking, and a last line under about eleven letters is a runt.
hyphenation: { leftMin: 2, rightMin: 2 }, hyphenateAcrossColumns: false,
maxWordSpacing: 1.6, minWordSpacing: 0.8, maxJustifyTracking: 12, runtMinCharacters: 22,
};
Ingredienti
- Funzionalità
- Sillabazione e lingua del documentoDivisione in righe ottimale (Knuth–Plass)Testatine e folioCarattere del testo correnteRientri, allineamento e spaziatura dei paragrafiVedove, orfane e righe corteAperture progettateStili di titoloAttributi dei titoliTesto, filetti e riquadri nei progetti di paginaTestatine secondo il ruolo della paginaMargini speculariColore della cartaStili di paragrafoMetadati del documentoTavolozza di colori semanticaEsportazione in PDFFont incorporati nel PDF
- Usa anche
- Testatine per sezione
- Tipo
- Literata, GFS Didot (SIL OFL 1.1)
- Risorse
- Nessuna: ogni immagine è disegnata nel codice
Preparazione
#1 · Dichiara la lingua: el
Il codice è la risposta breve qui sopra. locale: 'el' prende gli schemi del greco monotonico (sillabazione). Tengono interi i digrammi μπ, ντ, γκ, τσ, τζ e i dittonghi e dividono tra due consonanti come una grammatica scolastica greca: la pagina 3 divide εση-κώθηκε e μεσο-φόρι. leftMin e rightMin a 2 vietano una lettera sola da un lato del taglio, e hyphenateAcrossColumns: false impedisce che una pagina finisca su una parola divisa. Le parole greche sono lunghe; spazi da 0,8 a 1,6 volte quello del carattere, e poi fino al 12 ‰ di spaziatura, pareggiano le righe.
#2 · Testatine in maiuscolo
// textTransform 'uppercase' in a Greek document writes ΚΩΝΣΤΑΝΤΙΝΟΣ ΘΕΟΤΟΚΗΣ for
// Κωνσταντίνος Θεοτόκης: Greek capitals carry no accent, and the engine removes the tonos
// (and keeps a dialytika, ΑΫΠΝΙΑ) as it sets the letters. The Markdown keeps the accents,
// so search and the PDF's text read the words as written.
const caps = (size, tracking, color = 'muted') => ({ fontFamily: TEXT, fontSize: pt(size),
fontWeight: 500, letterSpacing: pt(tracking), textTransform: 'uppercase', color: col(color) });
const SHIFT = (INNER - OUTER) / 2; // mm: the text block's centre is off the page's centre
const head = (id, content, parity, edge, x, y = 11.5, pages = 'body') => ({
kind: 'text', id, content, parity, pages, ...caps(7.5, 1.4), placement: at('page', edge, x, y),
});
const folio = { fontWeight: 400, letterSpacing: pt(0), color: col('ink') }; // digits: no case
const header = { elements: [
{ ...head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER), ...folio },
head('verso-author', '{author}', 'even', 'top', -SHIFT),
head('recto-title', '{title}', 'odd', 'top', SHIFT),
{ ...head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER), ...folio },
] };
const drop = (parity, x) => ({ ...head(`drop-${parity}`, '{pageNumber}', parity, 'bottom', x,
-11, 'opener'), ...folio });
const footer = { elements: [drop('odd', SHIFT), drop('even', -SHIFT)] };
In un documento greco, textTransform: 'uppercase' scrive ΚΩΝΣΤΑΝΤΙΝΟΣ ΘΕΟΤΟΚΗΣ per Κωνσταντίνος Θεοτόκης: le maiuscole greche non portano tonos, e il motore lo toglie mentre compone le lettere, mentre la dieresi resta (ΑΫΠΝΙΑ). Il Markdown e il testo del PDF conservano le parole accentate, e la ricerca le trova. I numeri di pagina non hanno maiuscolo e minuscolo e restano nel peso 400.
#3 · Un numero di capitolo in Didot
// # Α΄ {style="chapter"}: the numeral is the heading's text, a capital and the Greek numeral
// sign ʹ (U+0374), as Greek books number their chapters.
const chapter = { id: 'chapter', breakBefore: { enabled: true, parity: 'odd' },
marginBottom: pt(0), // the opener's own height already ends on a line
advancedDesign: { enabled: true, minHeight: pt(10 * LEAD), slot: { elements: [
text('book', '{title}', TEXT, 8, at('container', 'top', 0, 2 * LINE),
caps(8, 2.2, 'muted')),
text('numeral', '{titleText}', DISPLAY, 30, at('container', 'top', 0, 3.6 * LINE),
{ color: col('accent'), lineHeight: 1 }),
rule('rule', 6.4 * LINE, 10),
] } },
};
Il titolo # Αʹ {style="chapter"} è il numero stesso: una maiuscola e la keraia ʹ, come i libri greci numerano i capitoli. Il disegno lo mette a 30 pt in GFS Didot sotto il titolo del libro, con un filetto corto, e minHeight abbassa il testo di dieci righe. breakBefore con parità odd apre il capitolo su dispari; uno stile di titolo fissa da sé il lato del salto.
La ricetta completa
// ═══ Postext Cookbook · Nº 201 · A Greek novel page, hyphenated in monotonic Greek ═══════
// https://postext.dev/en/cookbook/monotonic-greek-novel
// Code: MIT · Text: K. Theotokis, Η τιμή και το χρήμα, 1914 (PD, el.wikisource) · Pictures: none
// Fonts: Literata, GFS Didot (SIL OFL 1.1) · Needs postext ≥ 1.99.1
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the note on the text ('en' | 'es' | 'el')
const RECIPE = 'monotonic-greek-novel';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text on an ivory paper and one blue-grey accent, as the Athens literary presses
// set their novels between the wars.
const palette = {
ink: '#1f1d1b', // text
accent: '#2f4f6b', // chapter numeral, rules, the title on the title page
muted: '#6a645c', // running heads, the note on the text, the colophon
paper: '#fbf8f1', // an ivory book paper
};
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' } })),
{ id: 'main-color', name: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
const [TEXT, DISPLAY] = ['Literata', 'GFS Didot']; // a text face with Greek; a Greek Didot
const [BODY, LEAD] = [9.7, 14.2]; // pt
const LINE = (LEAD * 25.4) / 72; // mm: one line, 5.01
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
// Hung under another element, centred on it.
const under = (id, y) => ({ anchor: { to: id, edge: 'below', at: 'center' },
offset: { y: mm(y) } });
const text = (id, content, fontFamily, size, placement, extra = {}) => ({ kind: 'text', id,
content, fontFamily, fontSize: pt(size), color: col('ink'), align: 'center',
overflow: 'wrap', placement, ...extra });
const rule = (id, y, width) => ({ kind: 'rule', id, direction: 'horizontal', thickness: pt(0.5),
color: col('accent'),
placement: { ...at('container', 'top', 0, y), size: { width: mm(width) } } });
// #region page: a 13.5 × 20.5 cm novel; the text block holds 31 whole lines
const TRIM = { width: 135, height: 205 }; // mm
const [TOP, INNER, OUTER, LINES] = [20, 18, 21, 31];
const page = {
width: mm(TRIM.width), height: mm(TRIM.height), dpi: 150, backgroundColor: col('paper'),
margins: { top: mm(TOP), bottom: mm(TRIM.height - TOP - LINES * LINE),
left: mm(INNER), right: mm(OUTER), mirror: true }, // left is the inner margin on a recto
};
// 96 mm of measure: about 60 characters of Literata, nine or ten Greek words.
// #endregion
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)
Errori frequenti
Errore frequente
Uno stile di titolo eredita l’interruzione di pagina del suo livello
Una voce di headingStyles prende dal suo livello di titolo ogni campo che omette, breakBefore compreso. Un indice o un colophon con lo stile di un H1 dopo un :::pagebreak eredita parity 'odd' e finisce dietro una pagina bianca. Dai a uno stile del genere breakBefore: { enabled: false }. Stili di titolo →
- Una maiuscola che apre una parola nel testo corrente conserva il tonos, alla sua sinistra (Ό,τι, Ή κάνεις). Solo un
textTransform: 'uppercase'toglie gli accenti; il Markdown deve portarli sempre. - GFS Didot non ha il fleurone ❦ né il corsivo. Un ornamento o un’enfasi in quel carattere ricade su un altro font o su un tondo inclinato; questa ricetta usa la Didot solo per il titolo e il numero.
- Le battute brevi di dialogo in una giustezza di 96 mm lasciano poca scelta alla giustificazione. La cattura conta 3 righe su 97 oltre 1,6 volte lo spazio normale, la peggiore a pagina 4; una giustezza più larga o un corpo minore ne riducono il numero.
Crediti
- Ricetta
- Ignacio Ferro
- Testo
- Η τιμή και το χρήμα (1914), chapter I, complete, from the monotonic transcription of el.wikisource (revision 101144), with one misprint corrected, one opening guillemet restored, elision marks as ’ and each line of dialogue a paragraph · Konstantinos Theotokis · pubblico dominio
- The note on the text and the colophon · Postext Cookbook · originale
- Font
- Literata (SIL OFL 1.1) · GFS Didot (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)


