简单来说
一首著名的苏联诗歌,诗行像楼梯一样沿页面向下走。每一级都从上一级结束的地方开始,页面用红黑两色,像那个年代的海报。
成品一览
《苏联护照》(Стихи о советском паспорте,1929年)全诗,排在四页170 × 260毫米的纸上。马雅可夫斯基把诗行拆成台阶,每一级都从上一级停下的地方开始,《全集》把每一级算作一行。正文用Golos Text 12.5点、行距14.6点,三页分别是43、43和29级,写到护照的词句用特粗红字。最后一句落在第4页页脚的红色色块里。封面、页码标签和色块都是黑、红与纸本色的平涂图形,取法利西茨基为马雅可夫斯基做的版面。
这道食谱解答
- 怎样排阶梯诗(马雅可夫斯基的лесенка),让每一级从上一级的末尾开始?
- 怎样排诗歌:每句一行,诗节间留空,折行悬挂缩进,不断词?
简短回答
// A line of verse typed as the book prints it, its steps marked +:
// К любым
// + чертям с матерями
// + катись
// A step starts a word space after the end of the step above, so the steps keep the rhyme's
// line whole whatever the face or the size. They are lines: nothing joins them or divides
// them, and they are not hyphenated. A step that would run past the measure moves back until
// it fits; one wider than the whole measure turns over, `hang` in from its own start.
// align=start on the fence sets the poem flush left; by default it is centred.
const LOCALE = 'ru';
const verse = { turnover: 'hang', hang: em(2), tighten: true }; // config().bodyText.verse
const paragraphStyles = [
{ id: 'step', fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
textAlign: 'left', indent: mm(38), firstLineIndent: pt(0),
marginTop: pt(0), marginBottom: pt(0) },
{ id: 'shout', fontFamily: DISPLAY, fontWeight: 900, fontSize: pt(29), lineHeight: pt(27),
color: col('paper'), textAlign: 'left', firstLineIndent: pt(0), marginTop: pt(0),
marginBottom: pt(0) },
{ id: 'colophon', fontSize: pt(7.6), lineHeight: pt(10), color: col('paper'),
textAlign: 'left', firstLineIndent: pt(0), hyphenation: { enabled: false } },
];
用料
做法
#1 · 每一级用加号输入
代码见上面的简短回答。在:::verse围栏里,一行诗的第一级照原样输入,其余各级以+ 开头。引擎把它放在上一级末尾之后一个词距的位置。不必数空格或制表符,换字体、换字号时整座楼梯会跟着走。会超出版心的一级往回移,直到放得下;只有比版心还宽的一级才转行,悬挂在自己的起点下面。
#2 · 用红色提高嗓门
const characterStyles = [{ id: 'loud', name: 'Loud', fontWeight: 900, color: col('red') }];
利西茨基为马雅可夫斯基设计的书靠粗细和颜色来呐喊。这里交给一个字符样式::span[Но эту…]{style="loud"}用Golos Text 900和红色;下一级从它的末尾量起,所以台阶依然准确。
#3 · 每十级编一个号
const lineNumbers = { enabled: true, count: 'verse', restart: 'document', interval: 10,
position: 'left', gap: mm(-32), // the column starts at the trim: 32 mm in from its edge
fontFamily: DISPLAY, fontWeight: 900, fontSize: pt(13), color: col('red') };
lineNumbers数的是诗行,一级台阶就是一行。全诗每页写一个围栏,lineStart=44和lineStart=87把计数接下去。栏从裁切边起,红色块才能出血;段落样式把诗缩进38毫米,负的gap把号码移进来。
#4 · 用路径画封面
const P = [60, 78]; // the passport's top corner
const flat = { pages: 'opener' }; // the shapes: in the header slot, for the cover alone
const cover = { id: 'cover', numbered: false, breakBefore: { enabled: true, parity: 'odd' },
advancedDesign: { enabled: true, slot: { elements: [
text('year', '{attr.year}', 28, 'ink', at('page', 'top-right', -14, 15)),
text('one', '{attr.one}', 52, 'ink', at('page', 'top-left', 14, 182)),
text('two', '{attr.two}', 52, 'red', { ...at('#one', 'right-of', 3, 17) }),
text('three', '{attr.three}', 118, 'ink', at('page', 'bottom-left', 14, -12)),
] } } };
const coverShapes = [
poly('field', 'ink', [[0, 0], [124, 0], [0, 176]], flat),
disc('sun', 'paper', 88, 92, 52, flat),
bar('ray', 'ink', -6, 180, 190, 3, flat),
bar('passport', 'red', ...P, 74, 100, flat),
disc('seal', 'paper', ...on(...P, 37, 39), 17, flat),
disc('eye', 'ink', ...on(...P, 37, 39), 9, flat),
...[48, 36, 24].map((len, i) =>
bar(`line-${i}`, 'paper', ...on(...P, 13, 68 + 9 * i), len, 4, flat)),
text('author', '{author}', 26, 'paper', at('page', 'top-left', 14, 15), flat),
];
viewBox与页面同大时,路径可以直接用毫米坐标。路径不能旋转,所以bar按17度的斜度算出四个角。这些图形放在页眉槽里,设pages: 'opener',因为标题的设计会在版心底边被裁掉。诗题也走台阶:о советском锚定在Стихи的右边。
#5 · 页码放进标签
const tab = (parity, edge, x) => [
{ kind: 'box', id: `tab-${parity}`, parity, pages: 'body', style: { backgroundColor: col('ink') },
placement: { ...at('page', edge, 0, 22), size: { width: mm(13), height: mm(20) } } },
text(`folio-${parity}`, '{pageNumber}', 26, 'paper', at('page', edge, x, 28),
{ parity, pages: 'body' }),
];
const header = { elements: [...coverShapes, ...tab('even', 'top-left', 4.6),
...tab('odd', 'top-right', -4.6)] };
const LINES = 43; // three pages of 43, 43 and 29 steps, and five in the red field
const margins = { top: mm(22), bottom: mm(H - 22 - (LINES * LEAD * 25.4) / 72 - 0.1),
left: mm(0), right: mm(0) };
贴着书口的黑框里是页码,偶数页在左,奇数页在右,呼应《为了声音》的模切索引。pages: 'body'使它不出现在封面上。
#6 · 在红色块中收尾
const box = (id, y, top, bottom) => ({ id, placement: 'fixed', background: col('red'),
fixed: { anchor: { to: 'page', edge: 'bottom-left' }, offset: { x: mm(0), y: mm(y) } },
stripe: { enabled: false },
padding: { top: mm(top), right: mm(14), bottom: mm(bottom), left: mm(14) } });
const calloutStyles = [box('finale', -20.6, 10, 5), box('colophon', 0, 2, 8)];
最后五级单独放进一个:::callout,固定在页脚,与页面同宽。里面的围栏用shout样式:Sofia Sans Extra Condensed 900,29点。版权说明是下面的第二个框,两框之间露出的纸色就是海报上的白线。
完整食谱
// ═══ Postext Cookbook · Nº 206 · Mayakovsky in steps: the lesenka as he printed it ═════
// https://postext.dev/en/cookbook/stepped-verse-lesenka
// Code: MIT · Text: V. Mayakovsky, Стихи о советском паспорте, 1929 (PD; PSS, vol. 10)
// Fonts: Sofia Sans Extra Condensed, Golos Text (SIL OFL 1.1) · Needs postext ≥ 1.100.0
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 colophon ('en' | 'es' | 'ru')
const RECIPE = 'stepped-verse-lesenka';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Two inks on a raw paper, as the Constructivists printed: black, vermilion, no third.
const palette = {
ink: '#171412', // the verse, the fields
red: '#c9281b', // the passport, the loud steps, the last page
paper: '#f0e7d6', // an unbleached stock
};
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: 'red (defaults)', value: { hex: palette.red, model: 'hex' } },
];
const [TEXT, DISPLAY] = ['Golos Text', 'Sofia Sans Extra Condensed'];
const [BODY, LEAD] = [12.5, 14.6]; // pt
const [W, H] = [170, 260]; // mm: the sheet 70 × 108/16 of GOST 5773
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, size, color, placement, extra = {}) => ({ kind: 'text', id, content,
fontFamily: DISPLAY, fontWeight: 900, fontSize: pt(size), lineHeight: 0.8, color: col(color),
textTransform: 'uppercase', placement, ...extra });
// A flat shape in millimetres of the page: a polygon from its points, a disc from its radius.
const shape = (id, color, d, extra = {}) => ({ kind: 'path', id, d, viewBox: [W, H],
fill: col(color), ...extra, placement: { ...at('page', 'top-left'),
size: { width: mm(W), height: mm(H) } } });
const poly = (id, color, points, extra) =>
shape(id, color, `M${points.map((p) => p.join(' ')).join('L')}Z`, extra);
const disc = (id, color, x, y, r, extra) => shape(id, color,
`M${x - r} ${y}A${r} ${r} 0 1 1 ${x + r} ${y}A${r} ${r} 0 1 1 ${x - r} ${y}Z`, extra);
// A bar laid along a slant: `len` from (x, y) on the passport's own axes, `wide` across it.
const [UX, UY] = [Math.cos(-0.3), Math.sin(-0.3)]; // the slant: 17 degrees
const bar = (id, color, x, y, len, wide, extra) => poly(id, color, [[x, y],
[x + len * UX, y + len * UY], [x + len * UX - wide * UY, y + len * UY + wide * UX],
[x - wide * UY, y + wide * UX]].map((p) => p.map((n) => Math.round(n * 100) / 100)), extra);
const on = (x, y, u, v) => [x + u * UX - v * UY, y + u * UY + v * UX]; // a point on those axes
// #region answer: each step on its own line, led by a plus sign
// A line of verse typed as the book prints it, its steps marked +:
// К любым
// + чертям с матерями
组合好的script.js可以直接运行:把它粘贴到任何页面的模块脚本中,或在CodePen上打开这道食谱。 GitHub上的食谱文件夹 ↗ (在新标签页中打开)
常见问题
- 真正以加号开头的诗行写成
\+。 - 字号放大后,长诗行的台阶放不下,最后几级会往回移,看上去像排错。红色块里的这一句在29点时需要123毫米;放大之前先看最长的一行。
致谢
- 文本
- Стихи о советском паспорте, 1929, complete, after the Complete Works in thirteen volumes (vol. 10, 1958) in the transcription of ru.wikisource · Vladimir Mayakovsky · 公有领域
- The colophon · Postext Cookbook · 原创
- 字体
- Golos Text (SIL OFL 1.1) · Sofia Sans Extra Condensed (SIL OFL 1.1)


