本文へスキップ
レシピ番号151

レシピ集 · 第11章 · コミックと漫画

1ページに四コマを2本並べる

四コマ漫画のページ。4コマの列を2本並べ、右の列から読み、各作品のタイトルを1コマ目の黒い囲みに入れます。

このページの内容
出力
Canvas · PDF
レベル
中級
Postext
Postext 1.65.0で検証済み
1.65.0以上が必要 · postext-pdf ≥ 1.65.0
ライセンス
2026年10月31日更新
コードMIT · 本文CC BY 4.0

1〜1ページ · 1〜2/2

  • 仕上がり148 × 210 mm
  • 2段, 段間7.5 mm
  • Zen Antique 9/15
  • 2ページ
  • レベル
  • Postext 1.65.0
  • 組版時間507 ms
  • コード140行

かんたんな説明

漫画雑誌と同じように、4つのコマでできた短い漫画を2本、横に並べたページです。右の作品を上から下へ読み、次に左の作品を読みます。

できあがり

このレシピのために書き、やわらかいちびキャラの絵で描いた四コマ集『ねこ喫茶まどろみ』の1ページです。むぎは白猫、黒猫、三毛猫のいる猫カフェを営んでいます。四コマは、新聞のコマ漫画を縦に立てたような形式です。同じ大きさの4コマを上から下へ重ね、起・承・転・結で落とします。雑誌のページには2本を横に並べ、右開きなので右の作品から読みます。判型はA5判(148 × 210 mm)で、見開きの片側に日本語の原版、もう片側に英語版を置きます。

このレシピが答える質問

  • 4コマ漫画を組むには?

手短な答え

script.js · 46〜64行コード全体で見る
// content.<lang>.md splits the page `* [* / * / * / *] | * [* / * / * / *]`: two equal
// columns, each cut into four equal panels. The reading direction lays the first column
// out on the right, so the strip that opens the page is the right-hand one, as in a
// yonkoma magazine, and each strip still reads top to bottom. The gutter between the
// strips is wider than the gutters between their panels, so the eye drops down a strip
// before it crosses to the next.
const comics = (lang) => ({
  artDirection: 'rtl', // the right strip first, in every edition
  mirrorArt: false,
  gutter: { horizontal: mm(3), vertical: mm(9) }, // 3 mm between panels, 9 mm between strips
  panel: { borderWidth: pt(0.9), borderColor: col('ink'), background: col('paper') },
  lettering: {
    fontFamily: EDITIONS[lang].faces[0], color: col('ink'),
    fontSize: pt(['ja', 'zh'].includes(lang) ? 8 : 7), // a yonkoma letters smaller than a story
    writingMode: lang === 'zh' ? 'vertical' : 'auto',
    maxColumnChars: 6, // short columns: a yonkoma panel is wider than it is tall
  },
  balloonStyles: balloons(),
});

材料

種類
Zen Antique, Dela Gothic One, Comic Neue, Bangers, Noto Sans SC, ZCOOL KuaiLe, Playpen Sans Arabic, Lalezar (SIL OFL 1.1)
素材
  • neko-bowls.jpg
  • neko-door.jpg
  • neko-guest.jpg
  • neko-keyboard.jpg
  • neko-laptop.jpg
  • neko-nap.jpg
  • neko-onebowl.jpg
  • neko-toast.jpg
  • Mugi unlocking the cat café's door, three cats waiting inside (Generated With Diffusion Models, オリジナル)
  • Mugi setting out food bowls for the cats (Generated With Diffusion Models, オリジナル)
  • Three cats eating from one bowl (Generated With Diffusion Models, オリジナル)
  • The cats staring at Mugi's toast (Generated With Diffusion Models, オリジナル)
  • A tired office worker arriving at the café (Generated With Diffusion Models, オリジナル)
  • The three cats asleep on one cushion (Generated With Diffusion Models, オリジナル)
  • The office worker opening his laptop (Generated With Diffusion Models, オリジナル)
  • The cats sitting on the keyboard, the worker in happy tears (Generated With Diffusion Models, オリジナル)

作り方

#1 · ページを4コマの列2本に分ける

コードは前の手短な答えにあります。ページ全体が1つの:::pageで、コマ割りはsplit="* [* / * / * / *] | * [* / * / * / *]"です。同じ幅の2列を、それぞれ同じ高さの4段に分けます。8つの::panelの行は読む順にコマを埋めるので、最初の4つが1本目の作品になり、右から左へ読む設定では最初の列が右に置かれます(コマ割り)。作品と作品の間白は9 mm、コマとコマの間白は3 mmにしているので、視線は1本を下まで読んでから次の作品へ移ります。

#2 · 作品のタイトルを1コマ目に入れる

script.js · 68〜75行コード全体で見る
const balloons = () => [
  { id: 'speech', fill: col('paper'), stroke: col('ink'), strokeWidth: pt(0.6), roundness: 2.4 },
  { id: 'shout', fill: col('paper'), stroke: col('ink'), burstPoints: 16 },
  // caption{title}: the strip's title, white on black in the first panel's corner
  { id: 'title', shape: 'rectangle', fill: col('ink'), stroke: col('ink'), color: col('paper'),
    bold: true, tail: 'none', position: 'top-start', butt: true, align: 'center' },
  { id: 'sfx', color: col('ink'), haloColor: col('paper'), fontScale: 1.8 }, // chibi: small effects
];

四コマにはタイトルがあり、作品集では作品の頭に囲みで入れます。ここではタイトルも台本の1行(caption{title}: 朝ごはん)で、titleは専用の吹き出しのスタイルです。黒地に白抜きで、コマの枠の行頭側の上の角にぴったり付けます。この本では右上です。ほかの行と同じく版ごとに写植されるので、英語版では同じ囲みにBreakfastとTherapyが入ります。

#3 · 猫も話し手として位置を記す

script.js · 209〜350行コード全体で見る
const cat = (id, x, y, fx, fy, w = 0.12, h = 0.15) => ({ id, x, y,
  face: { x: fx, y: fy, width: w, height: h } });
const nose = (id, x, y) => ({ id, x, y, head: { x, y: y - 0.04 } }); // cats asleep or eating
const ART = { // fractions of the picture: the same in every language
  door: {
    alt: t({ en: "Mugi unlocks the café's glass door; the white, black and calico cats wait.",
      es: 'Mugi abre la puerta de cristal del café; dentro esperan los tres gatos.',
      ca: 'La Mugi obre la porta de vidre del cafè; a dins esperen els tres gats.',
      zh: '麦打开猫咖的玻璃门,三只猫在里面等着。',
      ar: 'موغي تفتح باب المقهى الزجاجي، والقطط الثلاث تنتظر في الداخل.',
      ja: '猫カフェのガラス戸を開けるむぎ。中で3匹の猫が待っている。',
      fr: 'Mugi ouvre la porte vitrée du café ; à l’intérieur, les trois chats attendent.',
      de: 'Mugi schließt die Glastür des Cafés auf; drinnen warten die drei Katzen.',
      it: 'Mugi apre la porta a vetri del caffè; dentro aspettano i tre gatti.',
      pt: 'Mugi abre a porta de vidro do café; lá dentro, os três gatos esperam.' }),
  safeArea: { x: 0.09, y: 0.19, width: 0.81, height: 0.52 },
  anchors: [{ id: 'mugi', x: 0.205, y: 0.385, head: { x: 0.17, y: 0.25 },
    face: { x: 0.1, y: 0.2, width: 0.2, height: 0.23 } },
  cat('shiro', 0.5, 0.66, 0.44, 0.55, 0.13), cat('kuro', 0.66, 0.62, 0.61, 0.52, 0.12, 0.14),
  cat('mike', 0.83, 0.645, 0.77, 0.53, 0.12, 0.16)] },
  bowls: {
    alt: t({ en: 'Mugi sets out full food bowls in front of the three cats.',
      es: 'Mugi pone cuencos llenos delante de los tres gatos.',
      ca: 'La Mugi posa bols plens de menjar davant dels tres gats.',
      zh: '麦把装满猫粮的碗摆在三只猫面前。',
      ar: 'موغي تضع صحون طعام ممتلئة أمام القطط الثلاث.',
      ja: '3匹の猫の前に、ご飯を盛った器を並べるむぎ。',
      fr: 'Mugi pose des bols pleins de nourriture devant les trois chats.',
      de: 'Mugi stellt den drei Katzen volle Futternäpfe hin.',
      it: 'Mugi mette le ciotole piene di cibo davanti ai tre gatti.',
      pt: 'Mugi põe tigelas cheias de comida na frente dos três gatos.' }),
  safeArea: { x: 0.16, y: 0.26, width: 0.74, height: 0.65 },
  anchors: [{ id: 'mugi', x: 0.27, y: 0.465, head: { x: 0.25, y: 0.3 },
    face: { x: 0.17, y: 0.26, width: 0.16, height: 0.24 } },
  cat('shiro', 0.37, 0.63, 0.31, 0.52, 0.13, 0.16), cat('kuro', 0.6, 0.64, 0.55, 0.52, 0.11, 0.16),
  cat('mike', 0.82, 0.62, 0.76, 0.52, 0.12, 0.14)] },
  onebowl: {
    alt: t({ en: 'All three cats push their heads into the same bowl; the others stay full.',
      es: 'Los tres gatos meten la cabeza en el mismo cuenco; los otros siguen llenos.',
      ca: 'Els tres gats fiquen el cap al mateix bol; els altres continuen plens.',
      zh: '三只猫把头挤进同一个碗里,另外两个碗还满着。',
      ar: 'القطط الثلاث تدسّ رؤوسها في الصحن نفسه، والصحنان الآخران ممتلئان.',
      ja: '3匹そろって同じ器に頭を突っこみ、ほかの器は手つかず。',
      fr: 'Les trois chats plongent la tête dans le même bol ; les autres restent pleins.',
      de: 'Alle drei Katzen stecken den Kopf in denselben Napf; die anderen bleiben voll.',
      it: 'I tre gatti infilano la testa nella stessa ciotola; le altre restano piene.',
      pt: 'Os três gatos enfiam a cabeça na mesma tigela; as outras continuam cheias.' }),
  safeArea: { x: 0.05, y: 0.27, width: 0.88, height: 0.66 },
  anchors: [nose('shiro', 0.33, 0.66), nose('kuro', 0.5, 0.6), nose('mike', 0.66, 0.68),
    { id: 'sfx', x: 0.5, y: 0.3 }] },
  toast: {
    alt: t({ en: 'Mugi bites her toast while the three cats stare at it with shining eyes.',
      es: 'Mugi muerde su tostada mientras los tres gatos la miran con ojos brillantes.',
      ca: 'La Mugi mossega la torrada mentre els tres gats la miren amb ulls brillants.',
      zh: '麦咬着吐司,三只猫眼睛发亮地盯着。',
      ar: 'موغي تقضم خبزها المحمّص والقطط الثلاث تحدّق فيه بعيون لامعة.',
      ja: 'トーストをかじるむぎを、3匹がきらきらした目で見つめる。',
      fr: 'Mugi croque sa tartine tandis que les trois chats la fixent, les yeux brillants.',
      de: 'Mugi beißt in ihren Toast, während die drei Katzen ihn mit leuchtenden Augen '
        + 'anstarren.',
      it: 'Mugi addenta il suo toast e i tre gatti lo fissano con gli occhi che brillano.',
      pt: 'Mugi morde a torrada enquanto os três gatos olham para ela com olhos brilhando.' }),
  safeArea: { x: 0.09, y: 0.22, width: 0.85, height: 0.56 },
  avoid: [{ x: 0.6, y: 0.52, width: 0.15, height: 0.1 }],
  anchors: [{ id: 'mugi', x: 0.8, y: 0.5, head: { x: 0.85, y: 0.32 },
    face: { x: 0.75, y: 0.25, width: 0.2, height: 0.33 } },
  cat('shiro', 0.17, 0.71, 0.1, 0.6, 0.14, 0.16), cat('kuro', 0.32, 0.73, 0.26, 0.62, 0.12, 0.14),
  cat('mike', 0.46, 0.66, 0.4, 0.56, 0.12, 0.14)] },
  guest: {
    alt: t({ en: 'A tired office worker walks in, arms out; Mugi greets him from the counter.',
      es: 'Un oficinista cansado entra con los brazos abiertos; Mugi lo saluda desde la barra.',
      ca: 'Un oficinista cansat entra amb els braços oberts; la Mugi el saluda des de la barra.',
      zh: '一个疲惫的上班族张着双臂走进来,麦在柜台后招呼他。',
      ar: 'موظف متعب يدخل فاتحًا ذراعيه، وموغي ترحّب به من خلف المنضدة.',
      ja: '両手を広げて入ってくる疲れた会社員と、カウンターから迎えるむぎ。',
      fr: 'Un employé de bureau fatigué entre les bras ouverts ; Mugi l’accueille depuis le '
        + 'comptoir.',
      de: 'Ein müder Büroangestellter kommt mit offenen Armen herein; Mugi begrüßt ihn '
        + 'von der Theke aus.',
      it: 'Un impiegato stanco entra a braccia aperte; Mugi lo accoglie dal bancone.',
      pt: 'Um funcionário de escritório cansado entra de braços abertos; Mugi o recebe do '
        + 'balcão.' }),
  safeArea: { x: 0.13, y: 0.14, width: 0.74, height: 0.51 },
  anchors: [{ id: 'kyaku', x: 0.31, y: 0.42, head: { x: 0.28, y: 0.3 },
    face: { x: 0.19, y: 0.22, width: 0.21, height: 0.26 } },
  { id: 'mugi', x: 0.76, y: 0.39, head: { x: 0.76, y: 0.28 },
    face: { x: 0.68, y: 0.2, width: 0.18, height: 0.25 } }] },
  nap: {
    alt: t({ en: 'The three cats asleep in one pile on a round cushion.',
      es: 'Los tres gatos dormidos en un montón sobre un cojín redondo.',
      ca: 'Els tres gats adormits en un munt sobre un coixí rodó.',
      zh: '三只猫挤成一团睡在圆垫子上。',
      ar: 'القطط الثلاث نائمة كومةً واحدة على وسادة مستديرة.',
      ja: '丸いクッションの上で、ひとかたまりになって眠る3匹。',
      fr: 'Les trois chats dorment en tas sur un coussin rond.',
      de: 'Die drei Katzen schlafen auf einem Haufen auf einem runden Kissen.',
      it: 'I tre gatti dormono ammucchiati su un cuscino rotondo.',
      pt: 'Os três gatos dormem amontoados numa almofada redonda.' }),
  safeArea: { x: 0.27, y: 0.21, width: 0.52, height: 0.55 },
  anchors: [nose('shiro', 0.4, 0.42), nose('kuro', 0.41, 0.7), nose('mike', 0.72, 0.58),
    { id: 'sfx', x: 0.3, y: 0.25 }] },
  laptop: {
    alt: t({ en: 'The office worker sighs at a café table and opens his laptop.',
      es: 'El oficinista suspira en una mesa del café y abre el portátil.',
      ca: 'L’oficinista sospira en una taula del cafè i obre el portàtil.',
      zh: '上班族在咖啡桌前叹了口气,打开笔记本电脑。',
      ar: 'الموظف يتنهّد إلى طاولة في المقهى ويفتح حاسوبه.',
      ja: 'カフェのテーブルでため息をつき、ノートパソコンを開く会社員。',
      fr: 'L’employé soupire à une table du café et ouvre son ordinateur portable.',
      de: 'Der Büroangestellte seufzt an einem Cafétisch und klappt seinen Laptop auf.',
      it: 'L’impiegato sospira a un tavolino del caffè e apre il portatile.',
      pt: 'O funcionário suspira numa mesa do café e abre o notebook.' }),
  safeArea: { x: 0.22, y: 0.25, width: 0.56, height: 0.55 },
  anchors: [{ id: 'kyaku', x: 0.45, y: 0.62, head: { x: 0.39, y: 0.4 },
    face: { x: 0.3, y: 0.3, width: 0.22, height: 0.38 } }] },
  keyboard: {
    alt: t({ en: 'The three cats sit on the keyboard; the worker cries tears of joy.',
      es: 'Los tres gatos se sientan en el teclado; el oficinista llora de alegría.',
      ca: 'Els tres gats seuen damunt del teclat; l’oficinista plora d’alegria.',
      zh: '三只猫坐在键盘上,上班族喜极而泣。',
      ar: 'القطط الثلاث تجلس على لوحة المفاتيح، والموظف يبكي من الفرح.',
      ja: 'キーボードの上に座る3匹と、うれし泣きする会社員。',
      fr: 'Les trois chats s’assoient sur le clavier ; l’employé pleure de joie.',
      de: 'Die drei Katzen setzen sich auf die Tastatur; der Angestellte weint vor Freude.',
      it: 'I tre gatti si siedono sulla tastiera; l’impiegato piange di gioia.',
      pt: 'Os três gatos sentam no teclado; o funcionário chora de alegria.' }),
  safeArea: { x: 0.07, y: 0.1, width: 0.81, height: 0.78 },
  anchors: [{ id: 'kyaku', x: 0.29, y: 0.42, head: { x: 0.25, y: 0.2 },
    face: { x: 0.15, y: 0.1, width: 0.27, height: 0.4 } },
  cat('shiro', 0.42, 0.57, 0.36, 0.48, 0.13, 0.14), cat('kuro', 0.59, 0.6, 0.53, 0.5, 0.12, 0.14),
  cat('mike', 0.74, 0.62, 0.68, 0.52, 0.12, 0.14)] },
};
const panels = () => Promise.all([
  comicPanel('door', asset('neko-door.jpg'), ART.door),
  comicPanel('bowls', asset('neko-bowls.jpg'), ART.bowls),
  comicPanel('onebowl', asset('neko-onebowl.jpg'), ART.onebowl),
  comicPanel('toast', asset('neko-toast.jpg'), ART.toast),
  comicPanel('guest', asset('neko-guest.jpg'), ART.guest),
  comicPanel('nap', asset('neko-nap.jpg'), ART.nap),
  comicPanel('laptop', asset('neko-laptop.jpg'), ART.laptop),
  comicPanel('keyboard', asset('neko-keyboard.jpg'), ART.keyboard),
]);

猫も話すので(kuro: にゃ)、どの絵にもむぎと同じように猫の口と顔を記します。リストを短くするために小さな関数を2つ使います。こちらを向いた猫にはcat()、顔が器やクッションに埋まっている猫にはnose()です。3コマ目ではむぎが絵に写っていないので、mugi{tail=top}の行はしっぽがコマの上の縁へ向かいます。

#4 · 各版の書体はその版の言葉で読み込む

script.js · 354〜366行コード全体で見る
const SFX = /^sfx[^::\n]*[::](.*)$/gm; // sound-effect lines: 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] };
  if (['ja', 'zh'].includes(lang)) { // CJK: only the files that hold these characters
    const effects = [...text.matchAll(SFX)].map((m) => m[1]).join('');
    await loadCjkFonts({ [face]: FONTS[face] }, text.replace(SFX, ''), { vertical: true });
    await loadCjkFonts({ [sfx]: FONTS[sfx] }, effects, { vertical: true });
  }
  if (lang === 'ar') await loadArabicFonts(faces, text);
  await loadComicFonts(faces, text); // the bold and italic the faces do not ship
}

書体にはそれぞれが組む言葉を渡します。Zen Antiqueには吹き出し、Dela Gothic Oneには描き文字(ガツガツ、じーっ、すやぁ、ずしっ)です。四コマのコマは縦より横が長いので、日本語の列は6字で折り返し(maxColumnChars: 6)、写植はストーリー漫画のページより0.5ポイント小さくしています。

#5 · 各版の向かいに原版を置く

script.js · 371〜381行コード全体で見る
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)];

サイトの言語ごとに2本を自分のファイルで写植し、見開きの反対側の日本語の原版と向かい合わせにします。日本語のページでは英語版と並べます。どの言語でも、右の作品から読む順は変わりません。

レシピの全体

Sandbox
// ═══ Postext Cookbook · Nº 151 · Two yonkoma strips on a page ═════════════════════════
// https://postext.dev/en/cookbook/yonkoma
// 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
// A page of a cat-café yonkoma: two four-panel strips side by side, the right one first.
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 = 'yonkoma';

// ─── 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'] },
  zh: { locale: 'zh-Hans', faces: ['Noto Sans SC', 'ZCOOL KuaiLe'] },
  ar: { locale: 'ar', faces: ['Playpen Sans Arabic', 'Lalezar'] },
  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'] },
};

// #region answer: two columns of four, read from the right
// content.<lang>.md splits the page `* [* / * / * / *] | * [* / * / * / *]`: two equal
// columns, each cut into four equal panels. The reading direction lays the first column
// out on the right, so the strip that opens the page is the right-hand one, as in a

組み立てた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を渡してください。どちらもテキストの文字を含むファイルを取得します。 中国語・日本語・韓国語のフォント →

  • 小さなコマでは、縦組みの吹き出しは幅より先に高さが足りなくなります。エンジンは行数を増やして一行を短くし、言葉の切れ目で改行します。会社員の最後の叫びは日本語では下のコマにそれでも収まらないので、breakを付けています(kyaku{shout break})。猫たちを隠さず、枠を上のコマへ突き破り、ページの余白へは出ません。
  • 大きな描き文字も吹き出しと同じく顔を避け、固定する点はコマのセーフエリアの中に置くので、どうトリミングされても残ります。ほかの版の描き文字は70% 80%、猫の足の上です。縦組みの「ずしっ」は背が高く、そこでは三毛猫の顔にかかってビルドがcomicBalloonOverflowを警告したので、日本語版では三毛猫の横の86% 84%に置いています。

クレジット

レシピ
Ignacio Ferro
本文
  • ねこ喫茶まどろみ (Café Doze), two yonkoma strips written for this recipe, with their English, Spanish, Catalan, Chinese and Arabic letterings · Postext Cookbook · CC BY 4.0
画像
  • Mugi unlocking the cat café's door, three cats waiting inside · Generated With Diffusion Models · オリジナル
  • Mugi setting out food bowls for the cats · Generated With Diffusion Models · オリジナル
  • Three cats eating from one bowl · Generated With Diffusion Models · オリジナル
  • The cats staring at Mugi's toast · Generated With Diffusion Models · オリジナル
  • A tired office worker arriving at the café · Generated With Diffusion Models · オリジナル
  • The three cats asleep on one cushion · Generated With Diffusion Models · オリジナル
  • The office worker opening his laptop · Generated With Diffusion Models · オリジナル
  • The cats sitting on the keyboard, the worker in happy tears · 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)
SandboxPDF