Saltar al contingut principal
Recepta número 202

Receptari · Capítol 2 · Text i tipografia

Homer en grec politònic, encarat a la seva traducció

L’inici de l’Odissea a les parells i la versió en grec modern d’Eftaliotis a les senars, partits amb els patrons grc i numerats cada cinc versos.

En aquesta pàgina
Gènere
Poesia
Sortida
Canvas
Nivell
Intermedi
Postext
Provada amb Postext 1.99.1
Requereix ≥ 1.99.1
Llicència
Actualitzada el 29 de nov. del 2026
Codi MIT · Text CC BY 4.0
  • Mostra en castellà: encara no hi ha edició en català
  • Format 140 × 215 mm
  • 1 columna
  • GFS Didot 10,2/15
  • 6 pàgines
  • Nivell
  • Postext 1.99.1
  • Compost en 42 ms
  • 150 línies de codi

En poques paraules

Els primers versos de l’Odissea d’Homer en grec antic, amb tots els accents i esperits, a les pàgines de l’esquerra, i una traducció en vers al grec modern a la dreta, cada vers a l’altura del que tradueix.

Què compondràs

Un petit clàssic de 14 × 21,5 cm en GFS Didot, la lletra politònica de la Greek Font Society. Obre amb una pàgina de la Vida d’Homer bizantina que la Suda dona sota el nom d’Hesiqui de Milet, amb l’epitafi d’Homer a Íos. Segueixen dos plecs: els versos 1 a 27 del primer cant de l’Odissea a les parells i la versió en quinzesíl·labs d’Argyris Eftaliotis a les senars, vers a vers, numerats cada cinc al marge exterior. Els tres textos són de domini públic i vénen de la Wikisource grega. Titolets i obertures posen els títols en versals, que perden tot esperit i accent.

Aquesta recepta respon a

  • Com componc un poema i la seva traducció en pàgines enfrontades, amb l'original sempre a la senar?
  • Com numero al marge cada cinquè vers d'un poema i remeto les meves notes a aquests números de vers?
  • Com componc poesia: un vers per línia, espai entre estrofes, sagnat francès als versos que no hi caben i sense partició de mots?
  • Com aconsegueixo una bona justificació i partició de mots en textos en castellà, francès o alemany?

La resposta curta

script.js · línies 31–51al codi complet
// locale 'grc' takes the polytonic patterns, which read breathings, circumflexes, the iota
// subscript and the diaeresis as the letters they sit on (Πει-σι-στρά-του, ὀφ-θαλ-μῶν,
// ἀ-ναμ-φί-λε-κτα). Eftaliotis's modern Greek is written polytonic too; under 'el' a
// polytonic word would be divided by the same patterns, so the two pages hyphenate alike.
// The labels are the modern Greek ones (Εικόνα, Πίνακας), as for 'el'.
const LOCALE = 'grc';
// Fontsource cuts each face into files by script, and loadFonts adds latin and greek. The
// accented letters of polytonic Greek (ἀ ὃ ῷ, U+1F00–1FFF) are in a third file, greek-ext:
// each face takes it too before the build, so no letter falls to a system font.
async function loadGreekExtended(faces) {
  const jobs = Object.entries(faces).flatMap(([family, specs]) => specs.map(async (spec) => {
    const id = fontsourceId(family);
    const style = spec.endsWith('i') ? 'italic' : 'normal';
    const file = `${id}-greek-ext-${parseInt(spec, 10)}-${style}.woff2`;
    const url = `${await fontsourceAt(id)}files/${file}`;
    const face = new FontFace(family, `url(${url}) format('woff2')`,
      { weight: String(parseInt(spec, 10)), style, unicodeRange: 'U+1F00-1FFF' });
    document.fonts.add(await face.load());
  }));
  await Promise.all(jobs);
}

Ingredients

Tipografia
GFS Didot (SIL OFL 1.1)
Recursos
Cap: totes les imatges es dibuixen en codi

Elaboració

#1 · Etiqueta el text com a grc i carrega’n les lletres accentuades

El codi és la resposta curta de dalt. locale: 'grc' pren els patrons politònics (partició), que llegeixen un esperit, un circumflex, una iota subscrita o una dièresi com a part de la lletra on van. La pàgina 1 talla Βατρα-χομυομαχία, ἐπι-δειξάμενος i τυράν-νου. Fontsource reparteix cada família per escriptures, i loadFonts només hi afegeix els fitxers latin i greek. Les lletres politòniques precompostes, U+1F00–1FFF, són en un tercer fitxer, greek-ext, que loadGreekExtended afegeix a cada família abans de compondre. Crida-la després de loadFonts, o el motor dona la família per carregada i se salta el fitxer greek.

#2 · Numera cada cinc versos al marge exterior

script.js · línies 67–73al codi complet
// Each page of verse is its own :::verse block. The Greek and the translation of a spread
// both open with {lineStart=11}, so the numbers on the two pages agree: restart 'poem'
// counts each block from its own start, and the epitaph, {numbered=false}, is not counted.
const lineNumbers = {
  enabled: true, count: 'verse', interval: 5, restart: 'poem', position: 'outer',
  gap: mm(6), fontFamily: DIDOT, fontSize: em(0.8), color: col('rubric'),
};

count: 'verse' numera només versos, i restart: 'poem' compta cada bloc :::verse des del seu inici. Cada pàgina de vers és un bloc. El grec i la traducció del segon plec obren tots dos amb {lineStart=11}, i els números de pàgines encarades coincideixen. position: 'outer' els porta al marge esquerre d’una parell i al dret d’una senar (números de línia). L’epitafi duu {numbered=false} i no té número.

#3 · Obertures i titolets en versals

script.js · línies 83–124al codi complet
// textTransform 'uppercase' turns Ὀδύσσεια into ΟΔΥΣΣΕΙΑ and Ῥαψῳδία into ΡΑΨΩΔΙΑ: Greek
// capitals take no breathing, no accent and no iota subscript (a dialytika stays, Ϊ Ϋ).
const caps = (size, tracking, color = 'muted') => ({ fontFamily: DIDOT, fontSize: pt(size),
  letterSpacing: pt(tracking), textTransform: 'uppercase', color: col(color) });
const opener = (title) => ({ enabled: true, minHeight: pt(5 * LEAD), slot: { elements: [
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', align: 'center', ...caps(8, 2, 'rubric'),
    placement: { ...at('container', 'top', 0, LINE), size: { width: 'fill' } } },
  { kind: 'text', id: 'title', content: title, align: 'center', ...caps(17, 3.5, 'ink'),
    placement: { ...at('container', 'top', 0, 2.2 * LINE), size: { width: 'fill' } } },
] } });
// # Ὀδύσσεια {style="original"} opens a verso, {style="translation"} the recto facing it;
// a style sets its own break side (gotcha: style-inherits-break).
const headingStyles = [
  { id: 'original', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'translation', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'life', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: { enabled: true, minHeight: pt(6 * LEAD), slot: { elements: [
      { kind: 'text', id: 'title', content: '{titleText}', align: 'center', ...caps(15, 3, 'ink'),
        placement: { ...at('container', 'top', 0, 1.6 * LINE), size: { width: 'fill' } } },
      { kind: 'text', id: 'source', content: '{attr.source}', align: 'center', fontFamily: DIDOT,
        fontSize: pt(10), color: col('muted'),
        placement: { ...at('container', 'top', 0, 3.2 * LINE), size: { width: 'fill' } } },
    ] } } },
  { id: 'note-page', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(LEAD),
    header: { elements: [] }, advancedDesign: { enabled: true, minHeight: pt(3 * LEAD),
      slot: { elements: [{ kind: 'text', id: 'label', content: '{titleText}', align: 'center',
        ...caps(7.5, 1.6, 'rubric'), placement: { ...at('container', 'top', 0, LINE),
          size: { width: 'fill' } } }] } } },
];
// The author and the title over the versos, the translator over the rectos; folios outside.
const head = (id, content, parity, edge, x, extra = {}) => ({ kind: 'text', id, content, parity,
  pages: 'body', ...caps(7.5, 1.5), ...extra, placement: at('page', edge, x, 12) });
const folio = { textTransform: 'none', letterSpacing: pt(0), fontSize: pt(9), color: col('ink') };
const SHIFT = (INNER - OUTER) / 2; // mm: the text block's centre is off the page's centre
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
  head('verso-head', '{author} · {title}', 'even', 'top', -SHIFT),
  head('recto-head', '{subtitle}', 'odd', 'top', SHIFT),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };

textTransform: 'uppercase' converteix Ὀδύσσεια en ΟΔΥΣΣΕΙΑ i Ῥαψῳδία en ΡΑΨΩΔΙΑ: les majúscules gregues no porten esperit, accent ni iota subscrita, i el motor els treu en compondre. L’estil original obre el grec en parell i translation la versió a la senar del davant. :::pagebreak{parity="even"} i {parity="odd"} fan el mateix al segon plec. El text de l’encapçalament i el del PDF queden com s’han escrit, amb totes les marques.

La recepta completa

Sandbox
// ═══ Postext Cookbook · Nº 202 · Homer in polytonic Greek, facing its translation ═══════
// https://postext.dev/en/cookbook/homer-polytonic-facing-translation
// Code: MIT · Texts: Homer, Hesychius, A. Eftaliotis (PD, el.wikisource) · Pictures: none
// Fonts: GFS Didot (SIL OFL 1.1) · Needs postext ≥ 1.99.1
// The opening of the Odyssey on the versos, Eftaliotis's line-for-line modern Greek on the
// rectos, both numbered every fifth line, after a page of the Byzantine Life of Homer.
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';

const LANG = 'es'; // @lang: the language of the note on the text ('en' | 'es' | 'el')
const RECIPE = 'homer-polytonic-facing-translation';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text on a warm white, and the dull red of a classical text's rubrics.
const palette = {
  ink: '#1c1a18', // the texts
  rubric: '#8c2f23', // line numbers, headings, rules
  muted: '#6b6359', // running heads, the note on the text, the colophon
  paper: '#fcfaf5',
};
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: 'rubric (defaults)', value: { hex: palette.rubric, model: 'hex' } },
];
const DIDOT = 'GFS Didot'; // the Greek Font Society's Didot: polytonic, with its own Latin
const [BODY, LEAD] = [10.2, 15]; // pt
const LINE = (LEAD * 25.4) / 72; // mm: one line, 5.29
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region answer: Ancient Greek is 'grc', with the polytonic accents written in the text
// locale 'grc' takes the polytonic patterns, which read breathings, circumflexes, the iota
// subscript and the diaeresis as the letters they sit on (Πει-σι-στρά-του, ὀφ-θαλ-μῶν,
// ἀ-ναμ-φί-λε-κτα). Eftaliotis's modern Greek is written polytonic too; under 'el' a
// polytonic word would be divided by the same patterns, so the two pages hyphenate alike.
// The labels are the modern Greek ones (Εικόνα, Πίνακας), as for 'el'.
const LOCALE = 'grc';
// Fontsource cuts each face into files by script, and loadFonts adds latin and greek. The
// accented letters of polytonic Greek (ἀ ὃ ῷ, U+1F00–1FFF) are in a third file, greek-ext:
// each face takes it too before the build, so no letter falls to a system font.
async function loadGreekExtended(faces) {
  const jobs = Object.entries(faces).flatMap(([family, specs]) => specs.map(async (spec) => {
    const id = fontsourceId(family);
    const style = spec.endsWith('i') ? 'italic' : 'normal';
    const file = `${id}-greek-ext-${parseInt(spec, 10)}-${style}.woff2`;
    const url = `${await fontsourceAt(id)}files/${file}`;
    const face = new FontFace(family, `url(${url}) format('woff2')`,
      { weight: String(parseInt(spec, 10)), style, unicodeRange: 'U+1F00-1FFF' });
    document.fonts.add(await face.load());

L'script.js compost funciona tal com és: enganxa'l com a script de mòdul en qualsevol pàgina o obre la recepta a CodePen. Carpeta de la recepta a GitHub ↗ (s'obre en una pestanya nova)

Errors freqüents

Error freqüent

Un estil de títol hereta el salt de pàgina del seu nivell

Una entrada de headingStyles pren del seu nivell de títol tot allò que no fixa, també breakBefore. Un índex o un colofó amb estil sobre un H1 després d'un :::pagebreak hereta la paritat 'odd' i cau darrere d'una pàgina en blanc. Dona a aquest estil breakBefore: { enabled: false }. Estils de títol →

  • Sense el fitxer greek-ext, cada vocal accentuada cau en una font del sistema que poques vegades hi lliga. La captura comprova cada glif amb els fitxers carregats (C36) i rebutja aquesta pàgina.
  • GFS Didot té un sol pes i no té cursiva: un èmfasi l’inclinaria el renderitzador. Per això la nota sobre el text va en rodona.
  • El proveïdor de fonts PDF del kit només carrega latin i greek, i aquesta recepta mostra el llenç sense oferir PDF.
  • Cap vers de la traducció no ha de passar de la caixa. Un vers que es parteix empeny una línia la resta de la pàgina, i les dues pàgines deixen de correspondre’s vers a vers; 103 mm a 10,2 pt hi caben el vers més llarg d’Eftaliotis, 59 lletres.

Crèdits

Text
  • Odyssey, Book I, lines 1–27, in the polytonic text of el.wikisource (revision 165777) · Homer · domini públic
  • The modern Greek translation of the same lines, line for line, from el.wikisource (revision 166701), with one accent corrected · Argyris Eftaliotis · domini públic
  • Life of Homer, §§ 6–7 and the epitaph, from the Suda (ed. A. Westermann, 1845), via el.wikisource (revision 152483), with four slips corrected · Hesychius of Miletus · domini públic
  • The note on the text and the colophon · Postext Cookbook · original
Fonts
GFS Didot (SIL OFL 1.1)
Sandbox