简单来说
一份虚构希腊地方报纸的头版:顶部是报名,下面是大写的大标题,头条分三栏、以一个大字母开头,还有小地图、船班时刻表和底部的简讯。
成品一览
《Ο Φάρος》(《灯塔报》)的头版,这是一个虚构港口小城的虚构日报,开本246 × 328 mm。报头用GFS Didot,左右两侧是报耳;头条在两行窄体大写标题和导语下面,分三栏Noto Serif排,栏间有细线,从三行下沉的首字母开始。一栏宽的海湾地图放在中间一栏。第二条新闻配船班时刻表,还有一条自成三栏的简讯带,收住全页。全部文字都是原创希腊语;末尾的出版说明随版本语言变化。
这道食谱解答
- Postext能排三栏或更多栏,或者让文字绕图排吗?
- 怎样给章首页加作者行、提要或带首字下沉的导语?
- 怎样让章标题横跨页面,下面的正文分两栏排?
- 怎样让西班牙文、法文或德文获得良好的两端对齐和断词?
简短回答
// 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 } } };
用料
做法
#1 · 三栏希腊语
代码就是上面的简短回答。layoutType: 'multiple'加columnCount: 3排出三栏,栏间一条细线(页面版式)。locale: 'el'按单调模式断词,这在69 mm的栏里很要紧,一个希腊词常占一行的三分之一。词距在正常的0.8到1.6倍之间,再加最多14‰的字距,全页只有一行超过1.6倍。
#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) } };
标题和导语放在banner框里,span: 'page'且无边框(框):下面各栏从同一高度起排,第二条新闻沿用这个手法。
#3 · 首字下沉与引词
段落样式lede给所在组的第一段加一个三行深的GFS Didot首字,leadIn把后面四个词排成大写:ΜΕ ΜΙΑ ΓΙΟΡΤΗ ΠΟΥ。它们同样去掉重音(首字下沉)。这条新闻以Μ开头;如果以带重音的大写字母(Έ、Ό)开头,要在页面上看看首字,因为希腊图书的首字母不带重音。
#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' } } },
] } };
报名在frontmatter里写作«Ο Φάρος»,排成加字距的Didot大写:ΦΑΡΟΣ。报耳读取标题属性issue、city、price和frontmatter里的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"的框:页面多出一行,整条简讯就移到下一页。删减文字直到放得下。 - 报耳宽52 mm。期号一行更长就会转行,第二行跑到报名第一个字母下面;按报名留下的空间来量报耳。
致谢
- 文本
- 原创文字, CC BY 4.0
- 字体
- GFS Didot (SIL OFL 1.1) · Fira Sans Condensed (SIL OFL 1.1) · Noto Serif (SIL OFL 1.1)


