Skip to main content
Recipe number 150

Cookbook · Chapter 11 · Comics & manga

An action page with slanted gutters

The page that decides a kendo final: slanted gutters (40~55) in the split, a borderless strike panel, and ドン kept in Japanese under a small translation.

On this page
Genre
Comics
Output
Canvas · PDF
Postext
Tested with Postext 1.65.0
Needs ≥ 1.65.0 · postext-pdf ≥ 1.65.0
Licence
Updated 31 Oct 2026
Code MIT · Text CC BY 4.0

pp. 1–1 · 1–2 of 2

  • Trim 128 × 182 mm
  • 2 columns, 7.5 mm gutter
  • Zen Antique 9/15
  • 2 pages
  • Level
  • Postext 1.65.0
  • Laid out in 166 ms
  • 150 lines of code

In short

One page of a fight in a Japanese comic, with tilted gaps between the panels so the action seems to lean, and the big Japanese sound of the hit left in place with a small translation beside it.

What you'll build

The page where the kendo final is decided, from the same manga as the right-to-left recipe, in two editions side by side: the Japanese original and its lettering in this page's language (English on the Japanese page). Four tiers: the gym, Hana's eyes through her helmet grille, the exchange, and the reactions. The third tier is cut by a gutter that leans, so the opponent's thrust and Hana's counter seem to rush at each other; the fourth leans the other way and slows the page down. Hana's strike has no frame at all, and its sound effect, ドン, is set in a heavy Japanese gothic that every edition keeps, with a small translation under it in the translated pages.

This recipe answers

  • How do I slant the gutters between panels?
  • How do I letter sound effects over the art?

The short answer

script.js · lines 46–64in full code
// The page is split in content.<lang>.md: `* [40~55 | *]` runs the gutter of the third
// tier from 40 % at the top to 55 % at the bottom, so both panels lean into the strike,
// and `24 [58~64 | *]` tilts the last tier the other way. The panel that lands the blow
// is drawn with `border=none`: no frame, so its speed lines run straight to the gutter.
// ドン keeps its Japanese face in every edition (`font=` on the line);
// the translations add a small subtitle under it, the way licensed manga gloss a drawn
// sound effect instead of redrawing it.
const comics = (lang) => ({
  artDirection: 'rtl', // drawn for right-to-left reading: slants and order mirror with it
  mirrorArt: false,
  gutter: { horizontal: mm(4), vertical: mm(2.5) }, // a slanted gutter keeps its width
  panel: { borderWidth: pt(1.1), borderColor: col('ink'), background: col('paper') },
  lettering: {
    fontFamily: EDITIONS[lang].faces[0], color: col('ink'),
    fontSize: pt(['ja', 'zh'].includes(lang) ? 8.5 : 7.5),
    writingMode: lang === 'zh' ? 'vertical' : 'auto',
  },
  balloonStyles: balloons(),
});

The slant is in the split; the impact is in the panel and the effect

Ingredients

Type
Zen Antique, Dela Gothic One, Comic Neue, Bangers, Noto Sans SC, ZCOOL KuaiLe, Playpen Sans Arabic, Lalezar (SIL OFL 1.1)
Assets
  • match-coach.jpg
  • match-eyes.jpg
  • match-final.jpg
  • match-lunge.jpg
  • match-stands.jpg
  • match-strike.jpg
  • The kendo final in a packed gym, two fighters between three referees (Generated With Diffusion Models, original)
  • Hana's eyes through her helmet grille (Generated With Diffusion Models, original)
  • The opponent lunging with speed lines (Generated With Diffusion Models, original)
  • Hana's leaping strike to the helmet (Generated With Diffusion Models, original)
  • Sora cheering in the stands (Generated With Diffusion Models, original)
  • Coach Mori nodding while the referees raise their flags (Generated With Diffusion Models, original)

Method

#1 · Slant the gutter in the split

The code is the short answer above. A size written 40~55 gives a cell's far edge two positions: 40 % of the tier at the top, 55 % at the bottom. The cells stay convex polygons, the gutter keeps its width measured across the slant, and with right-to-left reading the slant mirrors with the order, so the first cell is still the right-hand one. The page's split is 24 / 18 / * [40~55 | *] / 24 [58~64 | *]: two straight tiers to set up the moment, a slanted one for the hit, and a last one tilted the other way (page split).

#2 · Shout in bursts and let the effects break out

script.js · lines 68–76in full code
const balloons = () => [
  { id: 'speech', fill: col('paper'), stroke: col('ink'), strokeWidth: pt(0.6), roundness: 2 },
  { id: 'shout', fill: col('paper'), stroke: col('ink'), burstPoints: 18, burstDepth: 0.3 },
  { id: 'thought', fill: col('paper'), stroke: col('ink') },
  { id: 'inner', fill: col('tone'), stroke: col('tone'), strokeWidth: pt(0), italic: false },
  { id: 'caption', fill: col('paper'), stroke: col('ink'), strokeWidth: pt(0.5) },
  // white-edged on the art
  { id: 'sfx', color: col('ink'), haloColor: col('paper'), halo: pt(2.2) },
];

The kiai of both fighters are shouts: an 18-spike burst with deeper spikes than the default. The sound effects have no balloon at all; they are lettered on the art with a white edge, 2.2 pt, so they read over the speed lines. The strike's panel is written ::panel{art=strike border=none}, and its ドン carries break, so it may cross the slanted gutter into the panel beside it, the way a letterer lets a sound spill over the frame (sound effects).

#3 · Keep ドン in Japanese and subtitle it

script.js · lines 301–320in full code
const SFX = /^sfx(\{[^}\n]*\})?[ \t]*[::](.*)$/gm; // sound effects: the second face sets them
async function loadEdition(lang) {
  const text = TEXT[lang];
  const [face, sfx] = EDITIONS[lang].faces;
  const faces = { [face]: FONTS[face], [sfx]: FONTS[sfx] };
  const effects = [...text.matchAll(SFX)];
  for (const [, attrs = '', words] of effects) { // ドン keeps its face in every language
    const family = /font="([^"]+)"/.exec(attrs)?.[1];
    if (!family) continue;
    faces[family] = FONTS[family];
    await loadCjkFonts({ [family]: FONTS[family] }, words, { vertical: true });
  }
  if (['ja', 'zh'].includes(lang)) { // CJK: only the files that hold these characters
    const own = effects.filter(([, attrs = '']) => !attrs.includes('font=')).map((m) => m[2]);
    await loadCjkFonts({ [face]: FONTS[face] }, text.replace(SFX, ''), { vertical: true });
    await loadCjkFonts({ [sfx]: FONTS[sfx] }, own.join(''), { vertical: true });
  }
  if (lang === 'ar') await loadArabicFonts(faces, text);
  await loadComicFonts(faces, text); // the bold and italic the faces do not ship
}

In manga the sound effects are part of the drawing, and licensed editions usually leave them in place and add a small translation beside them. The script does the same: every edition has the line sfx{… font="Dela Gothic One" break}: ドン; the editions lettered in rows add vertical to it, so ドン keeps the column it has in the original, and set a second, smaller effect under it, WHAM or ¡ZAS!. Because the face is named on the line, each edition loads Dela Gothic One with just the characters of ドン, whatever its own lettering face is.

#4 · Fit the safe areas to slanted cells

script.js · lines 188–297in full code
const ART = { // fractions of the picture: the same in every language
  final: {
    alt: t({ en: 'The kendo final in a packed gym: two fighters cross swords among three referees.',
      es: 'La final en un pabellón lleno: dos rivales cruzan las espadas entre tres árbitros.',
      ca: 'La final en un pavelló ple: dos rivals creuen les espases entre tres àrbitres.',
      fr: 'La finale dans un gymnase comble : deux combattants croisent le sabre entre trois '
        + 'arbitres.',
      de: 'Das Kendo-Finale in einer vollen Halle: Zwei Kämpfer kreuzen zwischen drei '
        + 'Kampfrichtern die Schwerter.',
      it: 'La finale in una palestra gremita: due atleti incrociano le spade tra tre '
        + 'arbitri.',
      pt: 'A final num ginásio lotado: dois lutadores cruzam as espadas entre três árbitros.',
      zh: '座无虚席的体育馆里的决赛:两名选手在三名裁判之间交剑。',
      ar: 'النهائي في صالة ممتلئة: متباريان يتقاطع سيفاهما بين ثلاثة حكّام.',
      ja: '満員の体育館での決勝。3人の審判の間で2人が剣先を交える。' }),
  safeArea: { x: 0.22, y: 0.44, width: 0.56, height: 0.46 },
  anchors: [{ id: 'hana', x: 0.31, y: 0.51, head: { x: 0.31, y: 0.49 },
    face: { x: 0.28, y: 0.45, width: 0.07, height: 0.1 } },
  { id: 'rival', x: 0.68, y: 0.51, head: { x: 0.68, y: 0.49 },
    face: { x: 0.65, y: 0.46, width: 0.06, height: 0.09 } },
  { id: 'shinpan', x: 0.575, y: 0.585, head: { x: 0.575, y: 0.56 },
    face: { x: 0.56, y: 0.54, width: 0.03, height: 0.06 } }] },
  eyes: {
    alt: t({ en: "Hana's eyes through the bars of her helmet grille.",
      es: 'Los ojos de Hana tras las barras de la rejilla del casco.',
      ca: 'Els ulls de la Hana darrere les barres de la reixa del casc.',
      fr: 'Les yeux de Hana derrière les barreaux de la grille de son casque.',
      de: 'Hanas Augen hinter den Gitterstäben ihres Helms.',
      it: 'Gli occhi di Hana dietro le sbarre della grata dell’elmo.',
      pt: 'Os olhos de Hana atrás das barras da grade do capacete.',
      zh: '面罩铁栏后花的眼睛。',
      ar: 'عينا هانا خلف قضبان شبكة الخوذة.',
      ja: '面金の向こうの花の目。' }),
  safeArea: { x: 0.22, y: 0.26, width: 0.57, height: 0.38 },
  anchors: [{ id: 'hana', x: 0.5, y: 0.62, head: { x: 0.5, y: 0.4 },
    face: { x: 0.2, y: 0.3, width: 0.6, height: 0.3 } }] },
  lunge: {
    alt: t({ en: 'The opponent lunges at the viewer, speed lines all round.',
      es: 'El rival se lanza hacia el lector entre líneas cinéticas.',
      ca: 'El rival es llança cap al lector entre línies cinètiques.',
      fr: 'L’adversaire se jette vers le lecteur, entouré de lignes de vitesse.',
      de: 'Der Gegner stürzt auf den Betrachter zu, ringsum Bewegungslinien.',
      it: 'L’avversario si lancia verso chi guarda, tra linee cinetiche.',
      pt: 'O adversário avança contra o leitor entre linhas de velocidade.',
      zh: '对手在速度线中朝读者猛刺过来。',
      ar: 'الخصم يندفع نحو القارئ وسط خطوط السرعة.',
      ja: '集中線の中、こちらへ突いてくる相手。' }),
  safeArea: { x: 0.03, y: 0.01, width: 0.8, height: 0.61 },
  avoid: [{ x: 0.02, y: 0.42, width: 0.23, height: 0.18 }],
  anchors: [{ id: 'rival', x: 0.7, y: 0.2, head: { x: 0.7, y: 0.14 },
    face: { x: 0.63, y: 0.02, width: 0.15, height: 0.24 } }] },
  strike: {
    alt: t({ en: "Hana leaps and strikes the top of the opponent's helmet; the sword bends.",
      es: 'Hana salta y golpea la parte alta del casco del rival; la espada se dobla.',
      ca: 'La Hana salta i colpeja la part alta del casc del rival; l’espasa es doblega.',
      fr: 'Hana bondit et frappe le sommet du casque adverse ; le sabre plie.',
      de: 'Hana springt und trifft den Gegner oben auf den Helm; das Schwert biegt sich.',
      it: 'Hana salta e colpisce la sommità dell’elmo avversario; la spada si piega.',
      pt: 'Hana salta e acerta o alto do capacete do adversário; a espada se curva.',
      zh: '花跃起击中对手面罩顶部,竹剑弯了起来。',
      ar: 'هانا تقفز وتضرب أعلى خوذة الخصم؛ ينثني السيف.',
      ja: '跳び込んで相手の面を打つ花。竹刀がしなる。' }),
  safeArea: { x: 0.36, y: 0.06, width: 0.42, height: 0.77 },
  avoid: [{ x: 0.52, y: 0.48, width: 0.13, height: 0.16 }],
  anchors: [{ id: 'hana', x: 0.43, y: 0.25, head: { x: 0.43, y: 0.18 },
    face: { x: 0.38, y: 0.07, width: 0.1, height: 0.25 } }, { id: 'sfx', x: 0.75, y: 0.25 }] },
  stands: {
    alt: t({ en: 'Sora jumps up in the stands, fists raised, shouting.',
      es: 'Sora salta en la grada con los puños en alto, gritando.',
      ca: 'En Sora salta a la graderia amb els punys enlaire, cridant.',
      fr: 'Sora bondit dans les gradins, poings levés, en criant.',
      de: 'Sora springt auf der Tribüne auf, die Fäuste erhoben, und schreit.',
      it: 'Sora salta sugli spalti con i pugni alzati, gridando.',
      pt: 'Sora pula na arquibancada de punhos erguidos, gritando.',
      zh: '空在看台上跳起来,举着拳头大喊。',
      ar: 'سورا يقفز في المدرّجات رافعًا قبضتيه وهو يصيح.',
      ja: '観客席で拳を突き上げて叫ぶ空。' }),
  safeArea: { x: 0.08, y: 0.07, width: 0.69, height: 0.44 },
  avoid: [{ x: 0.08, y: 0.06, width: 0.12, height: 0.1 },
    { x: 0.64, y: 0.35, width: 0.1, height: 0.12 }],
  anchors: [{ id: 'sora', x: 0.51, y: 0.44, head: { x: 0.5, y: 0.37 },
    face: { x: 0.4, y: 0.3, width: 0.22, height: 0.2 } }] },
  coach: {
    alt: t({ en: 'Mori, arms crossed and eyes closed; behind him the referees raise their flags.',
      es: 'Mori, de brazos cruzados y ojos cerrados; detrás, los árbitros alzan las banderas.',
      ca: 'En Mori, de braços plegats i ulls tancats; darrere, els àrbitres alcen les banderes.',
      fr: 'Mori, bras croisés et yeux fermés ; derrière lui, les arbitres lèvent leurs '
        + 'drapeaux.',
      de: 'Mori, Arme verschränkt, Augen geschlossen; hinter ihm heben die Kampfrichter '
        + 'die Fahnen.',
      it: 'Mori, braccia conserte e occhi chiusi; dietro di lui gli arbitri alzano le '
        + 'bandiere.',
      pt: 'Mori, de braços cruzados e olhos fechados; atrás, os árbitros erguem as bandeiras.',
      zh: '森老师抱着双臂、闭着眼;身后的裁判举起了旗子。',
      ar: 'موري عاقد الذراعين مغمض العينين، وخلفه يرفع الحكّام راياتهم.',
      ja: '腕を組み目を閉じる森先生。後ろで審判が旗を上げる。' }),
  safeArea: { x: 0.16, y: 0.1, width: 0.76, height: 0.53 },
  avoid: [{ x: 0.55, y: 0.18, width: 0.4, height: 0.17 }, // the referees' flags
    { x: 0.22, y: 0.47, width: 0.25, height: 0.21 }], // Mori’s folded arms: his pose
  anchors: [{ id: 'mori', x: 0.29, y: 0.31, head: { x: 0.29, y: 0.2 },
    face: { x: 0.22, y: 0.1, width: 0.14, height: 0.24 } }] },
};
const panels = () => Promise.all([
  comicPanel('final', asset('match-final.jpg'), ART.final),
  comicPanel('eyes', asset('match-eyes.jpg'), ART.eyes),
  comicPanel('lunge', asset('match-lunge.jpg'), ART.lunge),
  comicPanel('strike', asset('match-strike.jpg'), ART.strike),
  comicPanel('coach', asset('match-coach.jpg'), ART.coach),
  comicPanel('stands', asset('match-stands.jpg'), ART.stands),
]);

A slanted cell is wider at one end than at the other, and the picture has to cover it whole. Each safe area is cut to what the panel needs, the eyes for the grille close-up and Sora's upper body for the cheer, so it fits inside the cell's widest crop and the engine never has to letterbox the picture.

#5 · Set the original beside each edition

script.js · lines 325–335in full code
const FACING = LANG === 'ja' ? 'en' : LANG; // Japanese readers see the English edition
const TEXT = { ja: original, [FACING]: LANG === 'ja' ? english : markdown };
await loadFonts(FONTS, Object.values(TEXT).join('\n'));
const resources = await panels();
const build = async (lang) => { // the same pictures and page; this language's lettering
  await loadEdition(lang);
  return withLoadedFonts(() => buildDocument({ markdown: TEXT[lang], resources,
    continuation: { pageIndexOffset: lang === 'ja' ? 1 : 2 } }, edition(lang)),
    { ...kitFonts(FONTS), text: TEXT[lang] });
};
const docs = [await build('ja'), await build(FACING)];

Each language of the site letters the page in its own file, and the Japanese original faces it on the other side of the spread (the Japanese page faces the English edition). ドン stays in every edition, each one brings its own subtitle (WHAM, ZAS!, PÁ!, PAF !, WUMM, SDENG!, 咚, بوم!), and the slants never move.

The whole recipe

Sandbox
// ═══ Postext Cookbook · Nº 150 · An action page with slanted gutters ═════════════════
// https://postext.dev/en/cookbook/manga-action-slants
// Code: MIT · Story: written for the recipe (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Zen Antique, Comic Neue and six more (SIL OFL 1.1) · Needs postext ≥ 1.65.0
// The last page of a kendo final: slanted panels, a borderless strike, ドン kept in every edition.
import {
  buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage, loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: this edition's language; the Japanese original faces it
const RECIPE = 'manga-action-slants';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: black ink on a warm white, one screen-tone grey
const palette = {
  ink: '#151413', // panel borders, balloon outlines, the lettering
  paper: '#fdfcf9', // the page and the balloons
  tone: '#e8e6e1', // the inner-voice box, a light screen tone
  muted: '#6f6b64',
  accent: '#a8322b', // the cover red (the Folio case in recipe.json)
};
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: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion

// The engine's lettering and sound-effect faces per language (defaultComicFont and
// defaultComicSfxFont), written out so FONTS and the PDF know them.
const EDITIONS = {
  ja: { locale: 'ja', faces: ['Zen Antique', 'Dela Gothic One'] },
  en: { locale: 'en-us', faces: ['Comic Neue', 'Bangers'] },
  es: { locale: 'es', faces: ['Comic Neue', 'Bangers'] },
  ca: { locale: 'ca', faces: ['Comic Neue', 'Bangers'] },
  pt: { locale: 'pt-BR', faces: ['Comic Neue', 'Bangers'] },
  fr: { locale: 'fr', faces: ['Comic Neue', 'Bangers'] },
  de: { locale: 'de', faces: ['Comic Neue', 'Bangers'] },
  it: { locale: 'it', faces: ['Comic Neue', 'Bangers'] },
  zh: { locale: 'zh-Hans', faces: ['Noto Sans SC', 'ZCOOL KuaiLe'] },
  ar: { locale: 'ar', faces: ['Playpen Sans Arabic', 'Lalezar'] },
};

// #region answer: the slant is in the split; the impact is in the panel and the effect
// The page is split in content.<lang>.md: `* [40~55 | *]` runs the gutter of the third
// tier from 40 % at the top to 55 % at the bottom, so both panels lean into the strike,
// and `24 [58~64 | *]` tilts the last tier the other way. The panel that lands the blow

The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)

Pitfalls

Pitfall

Tag a Japanese text 'ja', never zh-Hans or LANG

A recipe's editions are en and es, but a Japanese sample is Japanese in both: `locale: LANG` would tag it English or Spanish, and a Chinese tag would set it by the Chinese rules (Kaiming punctuation, small kana free to start a line, 图 for 図, Chinese glyph forms in the PDF). From postext 1.30 the tag is also the language the text is shaped in (measured, painted and embedded), so any tag but 'ja' gives other glyph forms than the Japanese ones (the Chinese ones under a Chinese tag) and other line breaks. Write 'ja': it picks the Japan region (JLReq line breaking and punctuation, sesame emphasis marks, furigana spacing, 図 and 表 labels) and turns hyphenation off. The lint fails a text with kana under a zh or ko tag. Japanese line breaking (kinsoku) →

Pitfall

Chinese faces load by slices, through the cjk block

Fontsource serves a Chinese, Japanese or Korean family as about a hundred files per weight, each covering a range of characters. loadFonts fetches only the latin file, so on screen the Han characters come from a system face and measure wrong, and fontsourceProvider hands the PDF that latin file, which prints them as empty boxes. List the cjk kit block, call loadCjkFonts(FONTS, markdown) after loadFonts (once per voice, with the text it sets, when the book uses several CJK faces) and give renderToPdf fontProvider: cjkPdfProvider: both take the files that hold the text's characters. Chinese, Japanese and Korean fonts →

  • A sound effect kept in Japanese in an edition lettered in rows is set in a row, like the rest of the edition, unless its line says vertical.
  • Sora's cheer is longer than his small panel in Japanese, Spanish and Catalan: left to the engine it crossed the border and the build warned comicBalloonOverflow. Those editions mark it break (sora{shout break}): it bursts up through the frame into the gutter and the panel above on purpose, and nothing is reported. A break balloon never runs into the page margin unless its panel bleeds; a pin (at=) puts it anywhere else.

Credits

Text
  • 決勝 (The Final), a one-page kendo manga written for this recipe, with its English, Spanish, Catalan, Chinese and Arabic letterings · Postext Cookbook · CC BY 4.0
Images
  • The kendo final in a packed gym, two fighters between three referees · Generated With Diffusion Models · original
  • Hana's eyes through her helmet grille · Generated With Diffusion Models · original
  • The opponent lunging with speed lines · Generated With Diffusion Models · original
  • Hana's leaping strike to the helmet · Generated With Diffusion Models · original
  • Sora cheering in the stands · Generated With Diffusion Models · original
  • Coach Mori nodding while the referees raise their flags · Generated With Diffusion Models · original
Fonts
Zen Antique (SIL OFL 1.1) · Dela Gothic One (SIL OFL 1.1) · Comic Neue (SIL OFL 1.1) · Bangers (SIL OFL 1.1) · Noto Sans SC (SIL OFL 1.1) · ZCOOL KuaiLe (SIL OFL 1.1) · Playpen Sans Arabic (SIL OFL 1.1) · Lalezar (SIL OFL 1.1)
SandboxPDF