Коротко
Страница комикса, нарисованная один раз и разложенная тремя способами. Одни и те же пять картинок и диалог заполняют три разные сетки, и каждая картинка заново обрезается под свой кадр.
Что получится
Пробная вёрстка одной страницы комикса The Porthcove Light («Маяк Порткова»): титульный лист и та же страница в трёх планах, из которых выбирает автор. Пять картинок (Майя поднимается к маяку, её дед у молчащей рации, Майя показывает на пол, кошка спит на кабеле, ночью горит лампа) и шесть строк леттеринга не меняются; меняется только split каждого :::page. Каждая картинка заново обрезается под свою ячейку, а каждое облачко заново ставится вокруг персонажа. Обрезной формат — американский комикс, 168 × 259 мм, а проба выходит в десяти изданиях, в каждом леттеринг на своём языке.
Рецепт отвечает на вопросы
- Как разделить страницу на кадры комикса?
- Как сохранить лицо в поле зрения, когда кадр обрезает иллюстрацию?
- Как заново сделать леттеринг комикса на другом языке?
Короткий ответ
// Every :::page fills the type area; its split attribute cuts it into cells and its ::panel
// lines fill them in reading order (rows top to bottom, columns from the start side):
// :::page{split="30 / 35 [* | * | *] / *"} three tiers, the middle one in three
// :::page{split="60 [* / *] | * [* / * / *]"} two columns, then each column in tiers
// :::page{split="30 [30 | 20 | *] / *"} a 30 % tier cut 30 | 20 | rest, then the rest
// A size is a percentage of the parent cell, * shares what is left, [ … ] cuts that cell
// on the other axis. A panel with inset="x y w h" sits over the panel before it.
const comics = {
gutter: { horizontal: mm(4), vertical: mm(3) }, // between tiers, between panels in a tier
panel: { borderWidth: pt(1), borderColor: col('ink'), background: col('paper') },
lettering: { fontFamily: LETTERING, fontSize: pt(8), color: col('ink'), inset: mm(1) },
balloonStyles: [
{ id: 'speech', stroke: col('ink') },
{ id: 'caption', fill: col('caption'), stroke: col('ink') },
{ id: 'sfx', fontFamily: SFX, color: col('accent'), haloColor: col('paper') },
],
runningHeads: true, // a comic page has no running head unless asked: here, its folio
};
Ингредиенты
- Возможности
- Разбиение на кадрыРисунок кадра и кадрированиеПерсонажи и якоряБезопасная зона иллюстрацииРамки кадров и промежуткиСтраницы комиксовЛеттеринг комиксовЛеттеринг на других языкахСтили облачковЗвукоподражанияСемантическая палитраСтраницы на холстеЭкспорт в PDF
- Также применяет
- Абзацы в другом направленииВставки, вылеты и прорыв рамкиЦвет бумагиСтили абзацевШрифты, встроенные в PDFРисунки и таблицы как ресурсы
- Шрифты
- Comic Neue, Bangers, Zen Antique, Dela Gothic One, ZCOOL KuaiLe, ZCOOL QingKe HuangYou, Playpen Sans Arabic, Lalezar (SIL OFL 1.1)
- Материалы
lh-arrive.jpglh-beam.jpglh-biscuit.jpglh-maya.jpglh-radio.jpg- Panel picture: Maya arrives at the lighthouse (Generated With Diffusion Models, оригинал)
- Panel picture: Tomás at the radio (Generated With Diffusion Models, оригинал)
- Panel picture: Maya finds the problem (Generated With Diffusion Models, оригинал)
- Panel picture: Biscuit asleep on the cable (Generated With Diffusion Models, оригинал)
- Panel picture: the lamp lit at night (Generated With Diffusion Models, оригинал)
Порядок работы
#1 · Разделите страницу деревом разбивки
Код — в разделе Короткий ответ выше. :::page заполняет полосу набора, здесь 144 × 227 мм, а его атрибут split её делит. / разделяет ряды, | — колонки, каждый размер — процент от разделяемой ячейки, * делит остаток, а квадратная скобка делит эту ячейку ещё раз по другой оси (разбивка страницы). План C, 30 [30 | 20 | *] / *, делает ярус глубиной 30 %, делит его на ячейки шириной 30 % и 20 % плюс остаток и оставляет под ним одну высокую ячейку. Промежутки лежат поровну по обе стороны каждой линии: 4 мм между ярусами, 3 мм между кадрами яруса. Строки ::panel заполняют ячейки в порядке чтения: ряды сверху, колонки со стороны начала строки.

#2 · Дайте каждой картинке безопасную зону
// From the art manifest; fractions of each picture, the same in every language. The safe
// area is what every crop keeps: Tomás alone, not his radio, so a cell a fifth of the page
// wide still shows him; the lighthouse and the gallery, not the boat, so a tall cell holds them.
const ART = {
'lh-arrive': { width: 1100, height: 733, safeArea: { x: 0.22, y: 0.08, width: 0.4, height: 0.64 },
anchors: [{ id: 'maya', x: 0.29, y: 0.52, head: { x: 0.27, y: 0.47 },
face: { x: 0.22, y: 0.42, width: 0.12, height: 0.16 } },
{ id: 'biscuit', x: 0.4, y: 0.68, face: { x: 0.37, y: 0.64, width: 0.07, height: 0.08 } }],
avoid: [{ x: 0.51, y: 0.09, width: 0.1, height: 0.43 }],
alt: t({ en: 'A girl in a yellow raincoat walks up a coastal path towards a red-and-white '
+ 'lighthouse, a fat orange cat ahead of her.',
es: 'Una niña con chubasquero amarillo sube por un camino de costa hacia un faro rojo y '
+ 'blanco, con un gato naranja gordo delante.',
ca: 'Una nena amb impermeable groc puja per un camí de costa cap a un far vermell i blanc, '
+ 'amb un gat taronja gras al davant.',
zh: '一个穿黄色雨衣的女孩沿着海边小路走向红白相间的灯塔,一只胖胖的橘猫走在前面。',
ar: 'فتاة بمعطف مطر أصفر تصعد دربًا ساحليًا نحو منارة حمراء وبيضاء، وأمامها قط برتقالي سمين.',
ja: '黄色いレインコートの女の子が、赤と白の灯台へ続く海辺の小道をのぼっていく。前を太ったオレンジ色の猫が歩く。',
pt: 'Uma menina de capa de chuva amarela sobe um caminho à beira-mar rumo a um farol '
+ 'vermelho e branco, com um gato laranja gordo à frente.',
fr: 'Une fillette en ciré jaune monte un sentier côtier vers un phare rouge et blanc, '
+ 'précédée d’un gros chat roux.',
de: 'Ein Mädchen in gelbem Regenmantel geht einen Küstenpfad zu einem rot-weißen '
+ 'Leuchtturm hinauf, eine dicke rote Katze vor ihr.',
it: 'Una bambina con l’impermeabile giallo sale per un sentiero costiero verso un faro '
+ 'bianco e rosso, preceduta da un grosso gatto rosso.' }) },
'lh-radio': { width: 1000, height: 1000,
safeArea: { x: 0.27, y: 0.38, width: 0.24, height: 0.3 },
anchors: [{ id: 'tomas', x: 0.345, y: 0.52, head: { x: 0.38, y: 0.44 },
face: { x: 0.29, y: 0.4, width: 0.16, height: 0.18 } }],
avoid: [{ x: 0, y: 0.44, width: 0.22, height: 0.26 }],
alt: t({ en: 'The old keeper, white-bearded, in a navy sweater and cap, taps a valve radio '
+ 'with the microphone in his hand.',
es: 'El viejo farero, de barba blanca, jersey azul marino y gorra, golpea una radio de '
+ 'válvulas con el micrófono en la mano.',
ca: 'El vell faroner, de barba blanca, jersei blau marí i gorra, pica una ràdio de vàlvules '
+ 'amb el micròfon a la mà.',
zh: '白胡子的老守塔人穿着藏青色毛衣、戴着帽子,手握话筒,敲着一台电子管收音机。',
ar: 'حارس المنارة العجوز بلحيته البيضاء وكنزته الكحلية وقبعته ينقر على مذياع قديم '
+ 'والميكروفون في يده.',
ja: '白いひげの老灯台守が、紺のセーターに帽子姿でマイクを握り、真空管ラジオをたたいている。',
pt: 'O velho faroleiro, de barba branca, suéter azul-marinho e boné, dá batidinhas num '
+ 'rádio valvulado com o microfone na mão.',
fr: 'Le vieux gardien, barbe blanche, pull bleu marine et casquette, tapote une radio à '
+ 'lampes, le micro à la main.',
de: 'Der alte Wärter mit weißem Bart, marineblauem Pullover und Mütze klopft auf ein '
+ 'Röhrenradio, das Mikrofon in der Hand.',
it: 'Il vecchio guardiano, barba bianca, maglione blu e berretto, picchietta su una radio a '
+ 'valvole con il microfono in mano.' }) },
'lh-maya': { width: 1100, height: 1100, safeArea: { x: 0.25, y: 0.27, width: 0.41, height: 0.68 },
anchors: [{ id: 'maya', x: 0.54, y: 0.565, head: { x: 0.5, y: 0.3 },
face: { x: 0.4, y: 0.33, width: 0.24, height: 0.29 } }],
avoid: [{ x: 0.27, y: 0.73, width: 0.25, height: 0.22 }],
alt: t({ en: 'Close-up of Maya frowning at the floor and pointing down.',
es: 'Primer plano de Maya, que frunce el ceño mirando al suelo y señala hacia abajo.',
ca: 'Primer pla de la Maya, que arrufa les celles mirant a terra i assenyala avall.',
zh: '玛雅的特写:她皱着眉头看着地板,手指向下指。',
ar: 'لقطة قريبة لمايا وهي تعقد حاجبيها ناظرةً إلى الأرض وتشير إلى أسفل.',
ja: 'マヤのアップ。眉をひそめて床を見つめ、下を指さしている。',
pt: 'Close de Maya, de testa franzida, olhando para o chão e apontando para baixo.',
fr: 'Gros plan sur Maya, sourcils froncés, qui fixe le sol et pointe le doigt vers le '
+ 'bas.',
de: 'Nahaufnahme von Maya, die mit gerunzelter Stirn auf den Boden blickt und nach unten '
+ 'zeigt.',
it: 'Primo piano di Maya, accigliata, che fissa il pavimento e indica in basso.' }) },
'lh-biscuit': { width: 1000, height: 1000,
safeArea: { x: 0.58, y: 0.25, width: 0.42, height: 0.33 },
anchors: [{ id: 'biscuit', x: 0.72, y: 0.355, head: { x: 0.73, y: 0.32 },
face: { x: 0.64, y: 0.27, width: 0.2, height: 0.18 } }],
avoid: [{ x: 0.93, y: 0.28, width: 0.07, height: 0.24 },
{ x: 0, y: 0.72, width: 0.4, height: 0.1 }],
alt: t({ en: 'Under the desk the fat orange cat sleeps on his back, right on top of the black '
+ 'radio cable.',
es: 'Bajo la mesa, el gato naranja gordo duerme panza arriba justo encima del cable negro '
+ 'de la radio.',
ca: 'Sota la taula, el gat taronja gras dorm panxa enlaire just a sobre del cable negre de '
+ 'la ràdio.',
zh: '桌子底下,胖橘猫四脚朝天地睡着,正好压在收音机的黑色电线上。',
ar: 'تحت المكتب ينام القط البرتقالي السمين على ظهره فوق سلك المذياع الأسود تمامًا.',
ja: '机の下で、太ったオレンジ色の猫がラジオの黒いコードの真上にあおむけで眠っている。',
pt: 'Debaixo da mesa, o gato laranja gordo dorme de barriga para cima bem em cima do cabo '
+ 'preto do rádio.',
fr: 'Sous le bureau, le gros chat roux dort sur le dos, juste sur le câble noir de la '
+ 'radio.',
it: 'Sotto la scrivania, il grosso gatto rosso dorme a pancia in su, proprio sopra il cavo '
+ 'nero della radio.',
de: 'Unter dem Schreibtisch schläft die dicke rote Katze auf dem Rücken, genau auf dem '
+ 'schwarzen Kabel des Funkgeräts.' }) },
'lh-beam': { width: 1200, height: 800, safeArea: { x: 0.15, y: 0.01, width: 0.25, height: 0.3 },
anchors: [{ id: 'maya', x: 0.235, y: 0.15,
face: { x: 0.21, y: 0.11, width: 0.05, height: 0.07 } },
{ id: 'tomas', x: 0.3, y: 0.145, face: { x: 0.28, y: 0.11, width: 0.04, height: 0.06 } }],
avoid: [{ x: 0.79, y: 0.55, width: 0.08, height: 0.09 }],
alt: t({ en: 'Night: the beam sweeps over a dark sea; Maya and her grandfather stand on the '
+ 'lantern gallery and a fishing boat shows its lights far out.',
es: 'De noche, el haz barre un mar oscuro; Maya y su abuelo están en la galería de la '
+ 'linterna y a lo lejos se ven las luces de un pesquero.',
ca: 'De nit, el feix escombra un mar fosc; la Maya i el seu avi són a la galeria de la '
+ 'llanterna i lluny es veuen els llums d’un pesquer.',
zh: '夜里,灯塔的光束扫过漆黑的海面;玛雅和外公站在灯室外的回廊上,远处一艘渔船亮着灯。',
ar: 'ليلًا يمسح الشعاع بحرًا مظلمًا، ومايا وجدّها واقفان على شرفة الفانوس، وفي البعيد قارب '
+ 'صيد بأضوائه.',
ja: '夜。光の帯が暗い海をなでる。マヤと祖父は灯室の回廊に立ち、沖には漁船の明かりが見える。',
pt: 'À noite, o facho varre um mar escuro; Maya e o avô estão na galeria da lanterna e, ao '
+ 'longe, aparecem as luzes de um barco de pesca.',
fr: 'La nuit, le faisceau balaie une mer sombre ; Maya et son grand-père se tiennent sur '
+ 'la galerie de la lanterne et, au large, un bateau de pêche montre ses feux.',
de: 'Nacht: Der Lichtstrahl streicht über ein dunkles Meer; Maya und ihr Großvater stehen '
+ 'auf der Galerie der Laterne, und weit draußen zeigt ein Fischerboot seine Lichter.',
it: 'Di notte il fascio di luce spazza un mare scuro; Maya e suo nonno sono sulla balconata '
+ 'della lanterna e, al largo, si vedono le luci di un peschereccio.' }) },
};
Каждая картинка нарисована один раз и обрезается так, чтобы заполнить любую ячейку. Безопасная зона — часть, которую любая обрезка сохраняет целиком (кадры и рисунки). У картинки с рацией это один смотритель, 24 % её ширины, поэтому ячейка 26 мм плана C показывает его от фуражки до сапог и теряет рацию; широкие ячейки планов A и B показывают обоих. В ячейке, форма которой не вмещает безопасную зону, картинка получает поля, а сборка предупреждает (comicPanelLetterbox). Якоря отмечают рот и лицо каждого персонажа в тех же долях, поэтому хвостики находят говорящих при любой обрезке.
#3 · Положите один кадр поверх другого
Разбивка плана C даёт четыре ячейки на пять кадров. Кошка входит с inset="50 50 46 46": кадр шириной 46 % и глубиной 46 %, поставленный на 50 %, 50 % предыдущего кадра, кадра Майи. Вставка ячейки не занимает, поэтому следующие кадры остаются на местах, а читают её сразу после кадра, который она закрывает.
#4 · Леттеринг десяти изданий с одной вёрстки
// The lettering and sound-effect faces of each edition: the engine's defaults, but for Chinese
// two ZCOOL faces drawn for cartoons instead of Noto Sans SC. content.<lang>.md holds the words
// of each edition under the same speaker ids; Japanese balloons are set vertically, and the
// Japanese and Arabic editions, read right to left, mirror the order of the panels in every row.
const [LETTERING, SFX] = t({
en: ['Comic Neue', 'Bangers'], es: ['Comic Neue', 'Bangers'], ca: ['Comic Neue', 'Bangers'],
ja: ['Zen Antique', 'Dela Gothic One'], zh: ['ZCOOL KuaiLe', 'ZCOOL QingKe HuangYou'],
ar: ['Playpen Sans Arabic', 'Lalezar'], pt: ['Comic Neue', 'Bangers'],
fr: ['Comic Neue', 'Bangers'], de: ['Comic Neue', 'Bangers'], it: ['Comic Neue', 'Bangers'],
});
Разбивка, картинки, обрезка и якоря одинаковы во всех языках; в content.<lang>.md только слова под одними и теми же id персонажей (maya, tomas). Японское издание ставит облачка вертикально, по восемь знаков в столбце, и отбрасывает последнюю 。; оно читается справа налево, как арабское, поэтому кадры каждого ряда отражены, а картинки нет. Кегль леттеринга во всех изданиях 8 пт: более длинная реплика делает облачко больше, но никогда не мельче шрифт (леттеринг).
Рецепт целиком
// ═══ Postext Cookbook · Nº 144 · One set of panels, three page splits ═══════════════
// https://postext.dev/en/cookbook/comic-page-splitters
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Comic Neue, Bangers and the faces of five editions (OFL) · Needs postext ≥ 1.25.0
//
// A layout proof for one page of a comic: the same five pictures and the same lines of
// dialogue laid out under three `split` trees. Each picture carries a safe area, so its subject
// stays in view whether its cell is wide, tall or square, and the lettering is placed again
// around the speakers' anchors on every page and in every language.
import {
buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage, loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: 'en' | 'es' | 'ca' | 'zh' | 'ar' | 'ja' | 'pt' | 'fr' | 'de' | 'it'
const RECIPE = 'comic-page-splitters';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the night sea, the lighthouse red and the yellow of the captions
const palette = {
ink: '#1b2430', // panel borders, lettering and text: a blue-black
accent: '#b8322a', // the lighthouse red: the proof's labels
caption: '#f4e7bf', // caption boxes, an old-paper yellow
muted: '#5f6873', // folios and the imprint
paper: '#fdfbf6',
};
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' } },
];
// #endregion
// #region editions: one comic, six editions, each lettered in faces for its script
// The lettering and sound-effect faces of each edition: the engine's defaults, but for Chinese
// two ZCOOL faces drawn for cartoons instead of Noto Sans SC. content.<lang>.md holds the words
// of each edition under the same speaker ids; Japanese balloons are set vertically, and the
// Japanese and Arabic editions, read right to left, mirror the order of the panels in every row.
const [LETTERING, SFX] = t({
en: ['Comic Neue', 'Bangers'], es: ['Comic Neue', 'Bangers'], ca: ['Comic Neue', 'Bangers'],
ja: ['Zen Antique', 'Dela Gothic One'], zh: ['ZCOOL KuaiLe', 'ZCOOL QingKe HuangYou'],
ar: ['Playpen Sans Arabic', 'Lalezar'], pt: ['Comic Neue', 'Bangers'],
fr: ['Comic Neue', 'Bangers'], de: ['Comic Neue', 'Bangers'], it: ['Comic Neue', 'Bangers'],
});
// #endregion
// #region answer: the comic: a frame, gutters, a panel border, and a page per split
// Every :::page fills the type area; its split attribute cuts it into cells and its ::panel
Собранный script.js работает как есть: вставьте его в модульный скрипт любой страницы или откройте рецепт на CodePen. Папка рецепта на GitHub ↗ (открывается в новой вкладке)
Варианты
#Наклоните средний ярус
Размер вида 30~40 ведёт дальний промежуток ячейки от 30 % на одном конце к 40 % на другом. У наклонных ячеек пропадают скруглённые углы.
-:::page{split="30 / 35 [* | * | *] / *"}
+:::page{split="30 / 35 [30~40 | * | *] / *"}#Отразите рисунки в изданиях справа налево
По умолчанию картинки не зеркалятся. Комикс, нарисованный без надписей и часов, может следовать направлению чтения.
const comics = {
+ mirrorArt: true, // pictures flip in a right-to-left edition
gutter: { horizontal: mm(4), vertical: mm(3) },Частые ошибки
- В ячейку шириной в пятую часть страницы при 8 пт помещается около четырёх слов в строке, а в плане C лицо смотрителя стоит посередине его кадра: два его облачка о шторме глубже места над ним и под ним. Там первая из двух реплик несёт
break(tomas{break}:), чтобы пара могла пересечь промежуток и зайти в кадр Майи; движок держит второе облачко после первого и никогда не выпускает его на поле страницы. Безbreakсборка предупреждаетcomicBalloonOverflow. - Более тесная безопасная зона даёт чистую обрезку большему числу ячеек, но всё, что за ней, может быть срезано: сапоги в первом ярусе плана A, рация в плане C.
Источники и лицензии
- Рецепт
- Ignacio Ferro
- Текст
- Оригинальный текст, CC BY 4.0
- Изображения
- Panel picture: Maya arrives at the lighthouse · Generated With Diffusion Models · оригинал
- Panel picture: Tomás at the radio · Generated With Diffusion Models · оригинал
- Panel picture: Maya finds the problem · Generated With Diffusion Models · оригинал
- Panel picture: Biscuit asleep on the cable · Generated With Diffusion Models · оригинал
- Panel picture: the lamp lit at night · Generated With Diffusion Models · оригинал
- Шрифты
- Comic Neue (SIL OFL 1.1) · Bangers (SIL OFL 1.1) · Zen Antique (SIL OFL 1.1) · Dela Gothic One (SIL OFL 1.1) · ZCOOL KuaiLe (SIL OFL 1.1) · ZCOOL QingKe HuangYou (SIL OFL 1.1) · Playpen Sans Arabic (SIL OFL 1.1) · Lalezar (SIL OFL 1.1)
Изменить описание рецепта ↗ (открывается в новой вкладке)Папка рецепта на GitHub ↗ (открывается в новой вкладке)


