かんたんな説明
架空のギリシャの地方紙の1面です。上に新聞名、大文字の大見出し、大きな頭文字で始まる3段組のトップ記事、小さな地図、船の時刻表、下に短いニュースが並びます。
できあがり
架空の港町で出る架空の日刊紙『Ο Φάρος』(「灯台」)の1面を、246 × 328 mmのコンパクト判で組みます。題字はGFS Didotで左右に題字脇を置き、トップ記事は幅の狭い大文字2行の見出しとリードの下から、段間に罫を引いたNoto Serifの3段に、3行のドロップキャップから流れます。湾の地図を1段幅で中央の段に置きます。船の時刻表を添えた2本目の記事と、独自の3段に組んだ短信の帯でページを締めます。文章はすべてギリシャ語の書き下ろしで、末尾の奥付だけが版の言語に従います。
このレシピが答える質問
- Postextは3段以上の段組みや、画像の周りへの回り込みに対応していますか?
- 章扉に著者名の行、リード文、ドロップキャップ付きの導入文を加えるには?
- 章タイトルをページ幅いっぱいに置き、その下で本文を2段組みにするには?
- スペイン語・フランス語・ドイツ語のテキストで、きれいな両端そろえとハイフネーションを得るには?
手短な答え
// locale 'el' hyphenates the narrow columns with the monotonic patterns and makes every
// capital setting drop the tonos: the lead headline is written «Ο φάρος του Αγίου Νικολάου
// ανάβει ξανά» in the Markdown and printed ΑΝΑΒΕΙ ΞΑΝΑ, never ΑΝΆΒΕΙ.
const LOCALE = 'el';
const layout = { layoutType: 'multiple', columnCount: 3, gutterWidth: mm(5),
columnRule: { enabled: true, color: col('rule'), lineWidth: pt(0.5) } };
const headline = { id: 'lead', fontSize: pt(30), lineHeight: pt(34), fontWeight: 800,
textTransform: 'uppercase', letterSpacing: em(0.01), marginBottom: pt(6) };
// :::paragraphs{style="lede"} opens the story: a drop cap three lines deep and its first
// four words in capitals, which drop the tonos the same way (ΜΕ ΜΙΑ ΓΙΟΡΤΗ).
const lede = { id: 'lede', firstLineIndent: pt(0),
dropCap: { lines: 3, fontFamily: NAME, color: col('aegean'), gap: mm(1.2),
leadIn: { words: 4, uppercase: true } } };
材料
- 機能
- 本文段落のドロップキャップ3段以上の段組みハイフネーションと文書の言語段間罫段抜きの囲み囲みの中や本文中の段組みフロートする囲み囲み見出しスタイル見出しの属性デザインした章扉ページデザインのテキスト・罫・ボックス独自のリソースの種類データから作る表キャプションのスタイル段落スタイルPDFの書き出し
- 種類
- GFS Didot, Fira Sans Condensed, Noto Serif (SIL OFL 1.1)
- 素材
- なし:画像はすべてコードで描画
作り方
#1 · ギリシャ語の3段組
コードは上の手短な答えです。layoutType: 'multiple'とcolumnCount: 3で、細い罫を挟んだ3段を作ります(ページレイアウト)。locale: 'el'が単調ギリシャ語のパターンで分綴します。69 mmの段ではギリシャ語の1語が行の3分の1を占めることも多く、分綴が効きます。語間を通常の0.8〜1.6倍、さらに最大14‰のトラッキングで、1.6倍を超える行はページに1行だけです。
#2 · 小文字で書いて大文字で刷る見出し
見出しは«Ο φάρος του Αγίου Νικολάου ανάβει ξανά ύστερα από σαράντα χρόνια»と書き、スタイルにtextTransform: 'uppercase'を設定します。ギリシャ語の文書では大文字がtonosを落とすので、ページにはギリシャの見出しの書き方どおりΑΝΑΒΕΙ ΞΑΝΑ、ΥΣΤΕΡΑと刷られます。袖見出し、題字脇、短信の題も同じ変換を受けます。
const banner = { id: 'banner', backgroundEnabled: false, span: 'page',
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
titleStyle: { ...sans(9, 700, 'aegean', { letterSpacing: pt(1.6),
textTransform: 'uppercase' }), gap: mm(1.5) }, // the kicker, from the fence's title
marginTop: pt(LEAD), marginBottom: pt(LEAD / 2),
body: { fontFamily: TEXT, fontSize: pt(12), lineHeight: pt(17), textAlign: 'left',
firstLineIndent: pt(0) } };
見出しとリードはspan: 'page'で枠のないbannerボックスに入れます(ボックス)。下の段は同じ高さから始まり、2本目の記事も同じ手を使います。
#3 · ドロップキャップと書き出し
段落スタイルledeはグループ最初の段落に、GFS Didotで3行分のドロップキャップを付け、leadInが続く4語を大文字で組みます:ΜΕ ΜΙΑ ΓΙΟΡΤΗ ΠΟΥ。これもアクセントを落とします(ドロップキャップ)。この記事はΜで始まります。アクセント付きの大文字(Έ、Ό)で始まる記事では、ギリシャの本は頭文字をアクセントなしで組むので、ページ上の頭文字を確かめてください。
#4 · 題字
const ear = (id, side, lines) => lines.map(([key, content, look], i) => text(`${id}-${key}`,
content, { ...look, align: side }, { ...(i === 0 ? at('container', `top-${side}`, 0, 6)
: at(`#${id}-${lines[i - 1][0]}`, 'below', 0, 1)), size: { width: mm(52) } }));
const caps = { letterSpacing: pt(1.4), textTransform: 'uppercase' };
const nameplate = { enabled: true, minHeight: mm(38), slot: { elements: [
text('name', '{titleText}', { fontFamily: NAME, fontSize: pt(60), lineHeight: 1.1,
color: col('aegean'), align: 'center', ...caps, letterSpacing: pt(4) },
{ ...at('container', 'top', 0, 1), size: { width: 'fill' } }),
...ear('start', 'left', [['k', '{attr.issue}', sans(8, 700, 'aegean', caps)],
['d', '{publishDate}', sans(9, 400)]]),
...ear('end', 'right', [['k', '{attr.city}', sans(8, 700, 'aegean', caps)],
['p', '{attr.price}', sans(9, 400)]]),
{ kind: 'rule', id: 'thick', thickness: pt(2.5), color: col('ink'),
placement: { ...at('container', 'top-left', 0, 32), size: { width: 'fill' } } },
{ kind: 'rule', id: 'thin', thickness: pt(0.5), color: col('ink'),
placement: { ...at('#thick', 'below', 0, 0.8), size: { width: 'fill' } } },
] } };
新聞名はフロントマターに«Ο Φάρος»と書き、字間を空けたDidotの大文字ΦΑΡΟΣで組みます。題字脇は見出しの属性issue、city、priceと、フロントマターのpublishDateを読みます。
レシピの全体
// ═══ Postext Cookbook · Nº 204 · A Greek daily's front page in three columns ═══════════
// https://postext.dev/en/cookbook/greek-daily-front-page
// Code: MIT · Text: original Greek news copy (CC BY 4.0) · Map: drawn in code (CC BY 4.0)
// Fonts: GFS Didot, Fira Sans Condensed, Noto Serif (SIL OFL 1.1) · Needs postext ≥ 1.99.1
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the imprint's last line; the paper is Greek
const RECIPE = 'greek-daily-front-page';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: newsprint, black ink and the paper's Aegean blue
const palette = {
ink: '#141518', // text and the heavy rules
aegean: '#1d4f91', // the accent: the nameplate, kickers, the ferry lines
foam: '#e4e9f0', // the In brief strip, the map's sea
land: '#efe9dc', // the map's land
rule: '#9a9890', // hairlines: the column rules, the imprint's rule
muted: '#5a5852', // bylines, captions' notes, the imprint
paper: '#f9f7f1', // newsprint
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.ink })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const [NAME, HEAD, TEXT] = ['GFS Didot', 'Fira Sans Condensed', 'Noto Serif']; // all with Greek
const TRIM = { width: 246, height: 328 }; // mm: a 3 : 4 compact
const SIDE = 12; // mm: newspaper margins, narrow and not mirrored
const LEAD = 13.5; // pt: the body leading, 1.5 × a 9 pt Noto Serif
const sans = (size, weight, colour = 'ink', extra = {}) => ({ fontFamily: HEAD, fontSize: pt(size),
fontWeight: weight, color: col(colour), ...extra });
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, overflow: 'wrap',
...look, placement });
// #region answer: Greek in three columns, the headline in capitals, the story under a drop cap
// locale 'el' hyphenates the narrow columns with the monotonic patterns and makes every
// capital setting drop the tonos: the lead headline is written «Ο φάρος του Αγίου Νικολάου
// ανάβει ξανά» in the Markdown and printed ΑΝΑΒΕΙ ΞΑΝΑ, never ΑΝΆΒΕΙ.
const LOCALE = 'el';
const layout = { layoutType: 'multiple', columnCount: 3, gutterWidth: mm(5),
columnRule: { enabled: true, color: col('rule'), lineWidth: pt(0.5) } };
const headline = { id: 'lead', fontSize: pt(30), lineHeight: pt(34), fontWeight: 800,
textTransform: 'uppercase', letterSpacing: em(0.01), marginBottom: pt(6) };
// :::paragraphs{style="lede"} opens the story: a drop cap three lines deep and its first
// four words in capitals, which drop the tonos the same way (ΜΕ ΜΙΑ ΓΙΟΡΤΗ).
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
よくあるつまずき
- ボックスの中でドロップキャップを求めても付きません。記事の最初の段落はボックスの中ではなく、ボックスの後の本文の流れに置きます。
- 短信は
placement="bottom"のボックスです。ページが1行あふれると、帯ごと次のページに移ります。収まるまで文章を削ってください。 - 題字脇の幅は52 mmです。号数の行が長いと折り返し、2行目が題字の最初の文字の下に入り込みます。題字が残す余白で題字脇の幅を測ってください。
クレジット
- 本文
- 書き下ろしの文章, CC BY 4.0
- フォント
- GFS Didot (SIL OFL 1.1) · Fira Sans Condensed (SIL OFL 1.1) · Noto Serif (SIL OFL 1.1)


