かんたんな説明
1914年のギリシャ語小説の第1章を、小さなペーパーバックとして組みます。行末の分綴はギリシャの学校文法どおりで、柱は大文字。ギリシャ語の大文字にはアクセントを付けません。
できあがり
コンスタンディノス・テオトキスの長編『Η τιμή και το χρήμα』(『名誉と金』、1914年)の第1章を、ギリシャ語版ウィキソースから取り、13.5 × 20.5 cmの本に組みます。前に扉と本文についての注記が入り、章は奇数ページで始まります。章番号ΑʹはGFS Didotで、10行下げた位置です。本文はLiterata 9.7/14.2 pt、1ページ31行、両端揃えで、単調ギリシャ語のパターンで分綴します。柱は偶数ページに著者、奇数ページに書名を、字間を空けた大文字で入れ、ギリシャ語の大文字の決まりどおりアクセントを落とします。注記と奥付は版の言語に従い、小説は3つの版すべてでギリシャ語のままです。
このレシピが答える質問
- スペイン語・フランス語・ドイツ語のテキストで、きれいな両端そろえとハイフネーションを得るには?
- 柱を設定するには(左ページに書名、右ページに章タイトル、ノンブルは小口側)?
- 会話のダッシュ、段落頭の年号、価格、記号そのものを、Markdownに誤読させずに書くには?
手短な答え
// 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,
};
材料
- 機能
- ハイフネーションと文書の言語最適な改行(Knuth–Plass)柱とノンブル本文の書体字下げ、行そろえ、段落間隔ウィドウ、オーファン、ラントデザインした章扉見出しスタイル見出しの属性ページデザインのテキスト・罫・ボックスページの役割ごとの柱見開きの余白用紙の色段落スタイル文書のメタデータセマンティックカラーパレットPDFの書き出しPDFに埋め込むフォント
- 併用する機能
- 節ごとの柱
- 種類
- Literata, GFS Didot (SIL OFL 1.1)
- 素材
- なし:画像はすべてコードで描画
作り方
#1 · 言語を指定する:el
コードは上の手短な答えです。locale: 'el'は単調ギリシャ語の分綴パターンを使います(分綴)。二重字μπ、ντ、γκ、τσ、τζと二重母音は切らず、2つの子音のあいだで分けるのはギリシャの学校文法と同じです。3ページ目ではεση-κώθηκεとμεσο-φόριに分かれます。leftMinとrightMinを2にすると、分割点の片側に1文字だけ残ることがなくなり、hyphenateAcrossColumns: falseでページが分綴された語で終わらなくなります。ギリシャ語は語が長いので、語間を書体本来の0.8〜1.6倍、さらに最大12‰のトラッキングで行をそろえます。
#2 · 大文字の柱
// 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)] };
ギリシャ語の文書では、textTransform: 'uppercase'がΚωνσταντίνος ΘεοτόκηςをΚΩΝΣΤΑΝΤΙΝΟΣ ΘΕΟΤΟΚΗΣと組みます。ギリシャ語の大文字はtonosを付けないので、エンジンが組むときに外し、分音記号は残します(ΑΫΠΝΙΑ)。MarkdownとPDFのテキストにはアクセント付きの語が残るので、検索で見つかります。ノンブルには大文字・小文字の区別がなく、ウェイト400のままです。
#3 · 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),
] } },
};
見出し# Αʹ {style="chapter"}がそのまま章番号です。大文字1字に数字記号ʹを添えるのが、ギリシャの本の章の数え方です。デザインはこれを書名の下に30 ptのGFS Didotで置き、短い罫を添え、minHeightで本文を10行下げます。breakBeforeのparityをoddにして奇数ページから始めます。見出しスタイルは改ページの側を自分で決めます。
レシピの全体
// ═══ 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
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
よくあるつまずき
つまずき
見出しスタイルはその階層の改ページを受け継ぐ
headingStylesの項目は、指定しなかったフィールドをすべて見出しの階層から受け継ぎ、breakBeforeも例外ではありません。:::pagebreakのあとのH1に付けた目次や奥付のスタイルはparity 'odd'を受け継ぎ、白ページの後ろに置かれます。こうしたスタイルにはbreakBefore: { enabled: false }を指定してください。 見出しスタイル →
- 本文中で語頭に立つ大文字はtonosを左側に保ちます(Ό,τι、Ή κάνεις)。アクセントを外すのは
textTransform: 'uppercase'だけで、Markdownには常にアクセントを書きます。 - GFS Didotには花形❦もイタリックもありません。この書体で飾りや強調を組むと、別の書体か傾けたローマン体になります。このレシピではDidotを書名と章番号にだけ使います。
- 96 mmの行長で短いせりふが続くと、行分けの選択肢が少なくなります。キャプチャでは97行中3行が通常の語間の1.6倍を超え、最悪は4ページ目です。行長を広げるか文字を小さくすると減ります。
クレジット
- 本文
- Η τιμή και το χρήμα (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 · パブリックドメイン
- The note on the text and the colophon · Postext Cookbook · オリジナル
- フォント
- Literata (SIL OFL 1.1) · GFS Didot (SIL OFL 1.1)


