かんたんな説明
漫画の試合の1ページです。コマとコマの間を斜めにして動きに勢いを出し、打った瞬間の大きな音の文字は日本語のまま残して、翻訳版では小さな訳を横に付けます。
できあがり
右から左へ読むレシピと同じ漫画から、剣道の決勝が決まるページを、日本語の原版と英語版の2つの版で並べます。段は4つで、体育館、面金越しの花の目、打ち合い、そして周りの反応です。3段目は傾いた間白で分けるので、相手の突きと花の返し技が互いにぶつかっていくように見えます。4段目は逆向きに傾けて、ページの勢いを落とします。花の打突のコマには枠がなく、その描き文字「ドン」は太いゴシックで、どの版でも日本語のまま残し、翻訳版ではその下に小さな訳を添えます。
このレシピが答える質問
- コマの間白を斜めにするには?
- 絵の上に擬音の描き文字を入れるには?
手短な答え
// 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(),
});
材料
- 機能
- コマ割り描き文字の擬音読む方向と漫画の順序中国語・日本語・韓国語のフォントコマの絵とトリミングコマの枠線と間白他言語への写植し直し話者とアンカー漫画のページ漫画の写植吹き出しのスタイル縦組み右綴じの本セマンティックカラーパレットキャンバス上のページPDFの書き出し
- 種類
- Zen Antique, Dela Gothic One, Comic Neue, Bangers, Noto Sans SC, ZCOOL KuaiLe, Playpen Sans Arabic, Lalezar (SIL OFL 1.1)
- 素材
match-coach.jpgmatch-eyes.jpgmatch-final.jpgmatch-lunge.jpgmatch-stands.jpgmatch-strike.jpg- The kendo final in a packed gym, two fighters between three referees (Generated With Diffusion Models, オリジナル)
- Hana's eyes through her helmet grille (Generated With Diffusion Models, オリジナル)
- The opponent lunging with speed lines (Generated With Diffusion Models, オリジナル)
- Hana's leaping strike to the helmet (Generated With Diffusion Models, オリジナル)
- Sora cheering in the stands (Generated With Diffusion Models, オリジナル)
- Coach Mori nodding while the referees raise their flags (Generated With Diffusion Models, オリジナル)
作り方
#1 · 間白の傾きはコマ割りに書く
コードは前の手短な答えにあります。サイズを40~55と書くと、そのコマの奥の辺は上端で段の40 %、下端で55 %の位置を通ります。コマは凸多角形のままで、間白は傾きに直交する方向で同じ幅を保ちます。右から左へ読むときは傾きも順番と一緒に反転するので、最初のコマはやはり右のコマです。このページのコマ割りは24 / 18 / * [40~55 | *] / 24 [58~64 | *]です。まっすぐな2段で場面を整え、打突の段を傾け、最後の段を逆に傾けます(コマ割り)。
#2 · 叫びはトゲの吹き出し、描き文字は枠からはみ出させる
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) },
];
ふたりの掛け声は叫びの吹き出しで、トゲを18本にし、標準より深くしています。描き文字には吹き出しがなく、効果線の上でも読めるように2.2 ptの白フチを付けて絵の上に置きます。打突のコマは::panel{art=strike border=none}と書き、その「ドン」にはbreakを付けるので、写植家が音を枠からはみ出させるのと同じように、傾いた間白を越えて隣のコマまで届きます(描き文字)。
#3 · ドンは日本語のまま、訳を添える
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
}
漫画の描き文字は絵の一部です。翻訳版の多くはそれをそのまま残し、横に小さく訳を付けます。台本も同じで、どの版にもsfx{… font="Dela Gothic One" break}: ドンの行があります。横組みの版はこの行にverticalを付けて「ドン」を原作どおり縦に保ち、その下に小さな2つめの描き文字、WHAMや¡ZAS!を加えます。行の中で書体を指定しているので、各版は自分の写植書体が何であっても、Dela Gothic Oneを「ドン」の文字だけで読み込みます。
#4 · セーフエリアを斜めのコマに合わせる
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),
]);
斜めのコマは片方の端がもう片方より広く、絵はコマ全体を覆わなければなりません。セーフエリアはコマに要るものだけに切り詰めます。面金の大写しなら目、応援の場面なら空の上半身です。そうすればコマのいちばん広い切り抜きにも収まり、絵の周りに余白ができることはありません。
#5 · 各版の向かいに原版を置く
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)];
サイトの言語ごとにページを自分のファイルで写植し、見開きの反対側に日本語の原版を置きます(日本語のページでは英語版と向かい合わせ)。「ドン」はどの版にも残り、各版が自分の訳(WHAM、ZAS!、PÁ!、PAF !、WUMM、SDENG!、咚、بوم!)を添え、傾きは動きません。
レシピの全体
// ═══ 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 = 'ja'; // @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
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
よくあるつまずき
つまずき
日本語のテキストのタグは'ja'。zh-HansやLANGにしない
レシピの版はenとesですが、日本語のサンプルはどちらの版でも日本語です。`locale: LANG`では英語やスペイン語とタグ付けされ、中国語のタグでは中国語の規則で組まれます(開明式の約物、小書きの仮名が行頭に来てもよい、図の代わりに图、PDFでは中国の字形)。postext 1.30以降、このタグはテキストを組む言語(計測、描画、埋め込みに使う言語)でもあるので、'ja'以外のタグでは日本語の字形ではなく別の字形(中国語のタグでは中国の字形)になり、改行の位置も変わります。'ja'と書いてください。日本の地域(JLReqの改行と約物、ゴマの圏点、ルビの間隔、図と表の表示名)が選ばれ、ハイフネーションが切られます。リントは、zhやkoのタグで仮名を含むテキストをエラーにします。 日本語の改行(禁則処理) →
つまずき
中国語の書体はcjkブロックを通じてスライス単位で読み込む
Fontsourceは中国語、日本語、韓国語のファミリーを、ウェイトごとに約100個のファイルとして配信し、各ファイルが文字の範囲を受け持ちます。loadFontsが取得するのはlatinファイルだけなので、画面では漢字がシステムの書体で出て計測が狂い、fontsourceProviderはPDFにそのlatinファイルを渡すため、漢字が空の四角で印字されます。キットのcjkブロックを挙げ、loadFontsのあとにloadCjkFonts(FONTS, markdown)を呼び(本で複数のCJK書体を使うときは、それぞれの書体で組むテキストを渡して書体ごとに1回)、renderToPdfにfontProvider: cjkPdfProviderを渡してください。どちらもテキストの文字を含むファイルを取得します。 中国語・日本語・韓国語のフォント →
- 横組みの版に日本語のまま残した描き文字は、行に
verticalがなければ、版のほかの文字と同じく横に組まれます。 - 空の歓声は日本語、スペイン語、カタルーニャ語では小さなコマより長く、エンジンにまかせると枠を越えてビルドが
comicBalloonOverflowを警告しました。これらの版ではbreakを付け(sora{shout break})、意図して枠を上へ、コマの間と上のコマへ突き破らせるので、何も報告されません。breakの吹き出しは、コマが裁ち落としでない限りページの余白へは出ません。別の場所に置くならat=で固定します。
クレジット
- 本文
- 決勝 (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
- 画像
- The kendo final in a packed gym, two fighters between three referees · Generated With Diffusion Models · オリジナル
- Hana's eyes through her helmet grille · Generated With Diffusion Models · オリジナル
- The opponent lunging with speed lines · Generated With Diffusion Models · オリジナル
- Hana's leaping strike to the helmet · Generated With Diffusion Models · オリジナル
- Sora cheering in the stands · Generated With Diffusion Models · オリジナル
- Coach Mori nodding while the referees raise their flags · Generated With Diffusion Models · オリジナル
- フォント
- 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)


