انتقل إلى المحتوى الرئيسي
الوصفة رقم 127

دليل الوصفات · الفصل 2 · الحروف والنص

كتاب مصوّر بالهيراغانا مع فراغ بين العبارات

كتاب مصوّر عمودي بالهيراغانا وبفراغ بين العبارات (wakachigaki): يُبقي keep-all كل عبارة كاملة، فلا تنكسر الأسطر إلا عند الفراغات.

في هذه الصفحة
المُخرَج
Canvas · PDF
المستوى
متوسط
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.25.0 · postext-pdf ≥ 1.25.0
الترخيص
حُدّثت في 10 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 260 × 200 مم
  • عمود ونصف, فاصل 14.1 مم بين الأعمدة
  • Klee One 20/36
  • Zen Maru Gothic
  • 10 صفحات
  • المستوى
  • Postext 1.57.1
  • أُخرجت في 46 ms
  • أسطر الشيفرة: 136

باختصار

كتاب مصوّر ياباني للأطفال الصغار، كله بالهيراغانا، مع فراغ بعد كل مجموعة كلمات وأسطر لا تقسمها أبدًا، تحت رسم في كل صفحة.

ما الذي ستنضده

كتاب مصوّر من عشر صفحات، かみの ふね (القارب الورقي)، كُتب لهذه الوصفة وزُيّن بعشر لوحات: بعد المطر تطوي فتاة قاربًا ورقيًا أحمر، فينزل القارب في النهر مارًّا بضفدع ومالك الحزين والقمر حتى يبلغ البحر. نُضّد كما تُنضَّد الكتب اليابانية لأصغر القرّاء: بالهيراغانا وحدها، بحجم 20 pt بخط Klee One المستلهم من خط الكتب المدرسية، وبفراغ بين العبارات، 分かち書き (wakachigaki)، ليقرأ الطفل عبارة عبارة. الصفحات أفقية بقياس 260 × 200 مم، عمودية النص ومجلدة على اليمين: الرسم في الأعلى، وتحته أسطر قصيرة من ثمانية أحرف، والقارب يسير نحو اليسار مع تقليب الصفحات.

تجيب هذه الوصفة عن

  • كيف أفصل عبارات كتاب مصوّر ياباني بفراغات (wakachigaki)، بأسطر لا تنكسر إلا عند الفراغات؟
  • لماذا لا يجوز أن يبدأ السطر الياباني بكانا صغيرة أو بـ ー أو بقوس مغلق، وكيف أختار درجة صرامة القاعدة؟
  • ما الخطوط التي تنضّد اليابانية، بالكانجي في أشكاله اليابانية، على الشاشة وفي PDF؟

الجواب المختصر

script.js · الأسطر 40–50في الشيفرة الكاملة
// The story is typed with an ordinary space (U+0020) after each phrase (文節). Japanese
// text may break between any two kana, so the space alone does not keep a phrase whole:
// keep-all drops the breaks between two letters and keeps those at a space, after 、。」
// and before 「. Kinsoku still applies.
const phrases = { wordBreak: 'keep-all' }; // cjk.wordBreak
const bodyText = {
  fontFamily: HAND, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
  boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
  // Ragged: a justified line would stretch its spaces and its kana to fill the tier.
  textAlign: 'left', firstLineIndent: em(0),
};

المكونات

الخطوط
Klee One, Zen Maru Gothic (SIL OFL 1.1)
الأصول
  • bridge-1400.jpg
  • cover-1430.jpg
  • dusk-1400.jpg
  • frog-1400.jpg
  • heron-1400.jpg
  • night-1400.jpg
  • rain-1400.jpg
  • sea-1400.jpg
  • stream-1400.jpg
  • window-1400.jpg
  • The cover: a red paper boat on a river through green meadows, a clear sky on the right for the title (Generated With Diffusion Models, أصلي)
  • Mii-chan folding the red paper boat at a low table by the window, after the rain (Generated With Diffusion Models, أصلي)
  • Mii-chan waving goodbye to the boat on the stream (Generated With Diffusion Models, أصلي)
  • A frog on a stone talking to the boat (Generated With Diffusion Models, أصلي)
  • The boat under a wooden footbridge, little fish following it (Generated With Diffusion Models, أصلي)
  • A white heron on the bank watching the boat on the wide river (Generated With Diffusion Models, أصلي)
  • Dusk: a pink sky over the river mouth and the sea beyond (Generated With Diffusion Models, أصلي)
  • Night: the full moon's reflection lighting the boat's way (Generated With Diffusion Models, أصلي)
  • The boat at sea, greeted by seagulls (Generated With Diffusion Models, أصلي)
  • Mii-chan at her window, looking towards the distant sea (Generated With Diffusion Models, أصلي)

طريقة التحضير

#1 · أبقِ كل عبارة كاملة

الشيفرة هي الجواب المختصر أعلاه. يمكن أن تنكسر اليابانية بين أي حرفي كانا، فالفراغ بين العبارات يضيف مسافة فقط، ولا يمنع السطر من الانتهاء داخل あか|い. ولا يُبقي cjk.wordBreak: 'keep-all' إلا الكسرات عند الفراغ وبجوار علامات الترقيم، بعد 、。」 أو قبل 「، كما يفعل word-break: keep-all في CSS، وتبقى قواعد الكينسوكو سارية (تنضيد نصوص شرق آسيا). والفراغ هو U+0020 العادي، بعرض 0.35 em في Klee One، ويحذفه السطر إذا وقع في آخره. أما U+3000 فيفصل العبارات أيضًا، لكنه حرف ثابت بعرض em كامل يبقى في آخر السطر.

الصفحة 3: ثمانية أسطر، ينتهي كل منها عند فراغ أو بعد 」 و、: 「いって / らっしゃい。」 / みいちゃんが / そっと てを…

النص غير مضبوط الطرفين. لو ضُبط لمدّ السطر القصير فراغاته والمسافات بين حروفه حتى يبلغ أسفل الطبقة؛ أما الكتاب المصوّر فيترك كل سطر حيث تنتهي آخر عباراته.

#2 · ضع الرسوم في طبقة فوق النص

script.js · الأسطر 54–62في الشيفرة الكاملة
// In vertical text 'left' is the top of the page: the side column is a tier that takes
// the pictures (floats), and the text runs in the tier under it, right to left.
const layout = {
  layoutType: 'oneAndHalf', writingMode: 'vertical-rl', sideColumnRole: 'floats',
  sideColumnSide: 'left', sideColumnPercent: 58, gutterWidth: pt(2 * BODY),
};
const cjk = { ...phrases, grid: { enabled: true, charsPerLine: CHARS, linesPerPage: LINES } };
const resourceTypes = [{ id: 'picture', name: 'え', shortLabel: 'え', numberingTemplate: '{n}',
  resetOn: 'never', counterFormat: 'decimal', captionPrefix: '' }]; // pictures, no captions

في النص العمودي تعني 'left' أعلى الصفحة، فتخطيط العمود والنصف بعموده الجانبي على اليسار يصير طبقتين: تطفو الرسوم في الطبقة العليا (بعمق 14 حرفًا)، ويجري النص في السفلى (8 أحرف). تستشهد كل صفحة برسمها بـ::resource{id="…"} وتنتهي بـ:::pagebreak. نوع مورد الرسوم بلا بادئة تعليق، وعرض الرسوم 2.186 مرة قدر ارتفاعها، أي شكل الطبقة، فتملؤها (الكتابة العمودية).

#3 · اجعل الغلاف رسمًا بحجم الصفحة

script.js · الأسطر 66–83في الشيفرة الكاملة
// In the flow frame of a vertical page x runs down the sheet and y leftward from its right
// edge; a box's width runs down the sheet.
const at = (down, across) => ({ anchor: { to: 'page', edge: 'top-left' },
  offset: { x: mm(down), y: mm(across) } });
const cover = {
  id: 'cover', numbered: false, toc: false, span: 'page', header: { elements: [] },
  breakBefore: { enabled: true, parity: 'any' },
  advancedDesign: { enabled: true, minHeight: mm(TRIM.w - 40), slot: { elements: [
    { kind: 'image', id: 'art', resourceId: 'cover', decorative: true,
      placement: { anchor: { to: 'bleed', edge: 'top-left' },
        size: { width: mm(TRIM.h), height: mm(TRIM.w) } } },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: ROUND, fontWeight: 700,
      fontSize: pt(60), lineHeight: 1, letterSpacing: pt(6), color: col('boat'),
      placement: at(22, 34) },
    { kind: 'text', id: 'latin', content: '{attr.latin}', fontFamily: ROUND, fontWeight: 700,
      fontSize: pt(9), lineHeight: 1.4, color: col('ink'), placement: at(22, 62) },
  ] } },
};

الغلاف تصميم عنوان بعرض الصفحة: يُربط الرسم بالنزف بحجم الصفحة نفسه (في التدفق العمودي يجري width نزولًا على الورقة)، وينزل العنوان في السماء على اليمين بخط Zen Maru Gothic بحجم 60 pt.

#4 · حمّل اللوحات صورًا نقطية

script.js · الأسطر 188–203في الشيفرة الكاملة
// The scenes have the tier's shape, 612 : 280 (ART); the cover has the page's, 260 : 200.
const PICTURES = { // id: [file, width, height, alt text in the book's language]
  cover: ['cover-1430.jpg', 1430, 1100, 'あおい かわに あかい かみの ふねが うかんで いる。'],
  rain: ['rain-1400.jpg', 1400, 641, 'まどべの ちゃぶだいで、みいちゃんが あかい かみで ふねを おって いる。'],
  stream: ['stream-1400.jpg', 1400, 641, 'みいちゃんが おがわに ふねを ながし、てを ふって いる。'],
  frog: ['frog-1400.jpg', 1400, 641, 'かわの いしの うえの かえるが、ながれて いく ふねに はなしかけて いる。'],
  bridge: ['bridge-1400.jpg', 1400, 641, 'きの はしの したを ふねが くぐり、ちいさな さかなが ついて くる。'],
  heron: ['heron-1400.jpg', 1400, 641, 'ひろい かわの きしで、しろい さぎが ふねを みおくって いる。'],
  dusk: ['dusk-1400.jpg', 1400, 641, 'ももいろの ゆうやけの かわに ふねが うかび、とおくに うみが みえる。'],
  night: ['night-1400.jpg', 1400, 641, 'まんげつが かわに うつり、ひかりの みちの そばを ふねが すすむ。'],
  sea: ['sea-1400.jpg', 1400, 641, 'あおい うみに でた ふねの うえを、かもめが とんで いる。'],
  window: ['window-1400.jpg', 1400, 641, 'みいちゃんが まどから、まちの むこうの うみを みて いる。'],
};
const pictures = Object.entries(PICTURES).map(([id, [fileId, w, h, altText]]) => ({
  id, typeId: 'picture', kind: 'bitmap', createdAt: 0, updatedAt: 0, altText,
  placement: { span: 'side' }, bitmap: { fileId, format: 'jpeg', width: w, height: h } }));

الصور العشر لوحات، ملفات JPEG في assets/ الخاص بالوصفة. قُصّت المشاهد التسعة على شكل الطبقة، ‎612 : 280، والغلاف على شكل الصفحة، ‎260 : 200، فتملأ كل صورة إطارها ولا يُقصّ منها شيء. كل صورة مورد bitmap مُعلَن بمقاسه بالبكسل، مع نص بديل بلغة الكتاب، ويُحمَّل ملفه باسم fileId الخاص بالمورد قبل التنضيد. بعرض 1400 بكسل تُطبع المشاهد بنحو 165 نقطة في البوصة على عرض الطبقة (أنواع الموارد).

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 127 · A hiragana picture book, spaced by phrase ══════════
// https://postext.dev/en/cookbook/hiragana-picture-book
// Code: MIT · Story: written for the recipe (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Klee One, Zen Maru Gothic (SIL OFL 1.1) · Needs postext ≥ 1.25.0
// A picture book for small readers: hiragana only, a space between phrases, vertical.
import {
  buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage, loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the frame; the story is Japanese in both editions
const RECIPE = 'hiragana-picture-book';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the paper boat's red, river blues, a warm paper
const palette = {
  ink: '#2e2a26', // the text: a soft near-black
  boat: '#cf4430', // the boat, the title (4.6:1 on the paper)
  river: '#5d93ad',
  grass: '#86b665',
  muted: '#6e675f', // the colophon
  paper: '#fbf6ea',
};
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: 'boat (defaults)', value: { hex: palette.boat, model: 'hex' } },
];
// #endregion

const HAND = 'Klee One'; // 教科書体: the hand a child learns to write kana from
const ROUND = 'Zen Maru Gothic'; // the cover's title
const [BODY, LEAD] = [20, 36]; // pt: large kana, a line gap of 0.8 em
const PT = 25.4 / 72; // mm in a point
const TRIM = { w: 260, h: 200 }; // mm: a landscape picture book (横長)
const [CHARS, PICTURE, LINES] = [8, 14, 17]; // characters: text tier, picture tier; lines
const ART = { w: LINES * LEAD * PT, h: PICTURE * BODY * PT }; // mm: 215.9 × 98.8

// #region answer: わかち書き — a space between phrases, and lines that break only there
// The story is typed with an ordinary space (U+0020) after each phrase (文節). Japanese
// text may break between any two kana, so the space alone does not keep a phrase whole:
// keep-all drops the breaks between two letters and keeps those at a space, after 、。」
// and before 「. Kinsoku still applies.
const phrases = { wordBreak: 'keep-all' }; // cjk.wordBreak
const bodyText = {
  fontFamily: HAND, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
  boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
  // Ragged: a justified line would stretch its spaces and its kana to fill the tier.

يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)

تنويعات

#اضبط طرفي الأسطر

إذا ضُبط الطرفان بلغ كل سطر أسفل الطبقة: تتمدد الفراغات بين العبارات أولًا، حتى نصف em، ثم المسافات بين حروف الكانا (JLReq §3.8). عندئذ تظهر في السطر القصير من كانا 20 pt فجوات واسعة، ولهذا تترك الوصفة أسطرها غير مضبوطة.

-  textAlign: 'left', firstLineIndent: em(0),
+  textAlign: 'justify', firstLineIndent: em(0),

أخطاء شائعة

خطأ شائع

اوسم النص الياباني بـ 'ja'، لا بـ zh-Hans ولا بـ LANG

نسختا الوصفة هما en وes، لكن المثال الياباني ياباني في كلتيهما: `locale: LANG` سيسمه بالإنجليزية أو الإسبانية، والوسم الصيني سينضّده بالقواعد الصينية (ترقيم Kaiming، وكانا صغيرة يجوز أن تبدأ بها الأسطر، و图 بدل 図، وأشكال صينية للحروف في PDF). ومنذ postext 1.30 صار الوسم أيضًا اللغة التي يُشكَّل بها النص (يُقاس ويُرسم ويُضمَّن بها)، فكل وسم غير 'ja' يعطي أشكالًا للحروف غير اليابانية (الصينية منها مع وسم صيني) وكسرًا آخر للأسطر. اكتب 'ja': يختار منطقة اليابان (كسر الأسطر والترقيم وفق JLReq، ونقاط السمسم، وتوزيع الفوريغانا، وتسميتي 図 و表) ويوقف تقسيم الكلمات. ويُفشل الفحصُ نصًّا فيه كانا موسومًا بـ zh أو ko. كسر الأسطر الياباني (kinsoku) →

خطأ شائع

انضد اليابانية بخط ياباني

في Noto Serif SC وTC كانا، لكنهما ترسمان الكانجي بأشكال صينية (يختلف 直 و骨 و角) والكانا بتصميم صيني. انضد النص بـ Noto Serif JP أو Shippori Mincho B1 والعناوين بـ Noto Sans JP، محمَّلة بـ loadCjkFonts. لا تحوي ملفات Fontsource اليابانية الهينتايغانا ولا غيرها من الكانا التاريخية (U+1B000–1B16F): يفشل loadCjkFonts عندها ويطبع PDF مربعات، فاكتب الكانا الحديثة أو ضع في أصول الوصفة خطًّا يحويها. ولا يحوي Shippori Mincho أيضًا الصائتين ō وū بالمدّة: انضد الروماجي بخط لاتيني. الكانا والكانجي والروماجي →

خطأ شائع

الخطوط الصينية تُحمَّل شرائح، عبر الكتلة cjk

يقدّم Fontsource العائلة الصينية أو اليابانية أو الكورية في نحو مئة ملف لكل وزن، يغطي كل منها نطاقًا من الحروف. لا يجلب loadFonts إلا ملف latin، فتأتي حروف الهان على الشاشة من خط النظام وتُقاس خطأً، ويسلّم fontsourceProvider ملف latin ذاك إلى PDF، فيطبعها مربعات فارغة. اذكر كتلة الأدوات cjk، واستدعِ loadCjkFonts(FONTS, markdown) بعد loadFonts (مرة لكل صوت، مع النص الذي يضعه، حين يستخدم الكتاب عدة خطوط CJK)، وأعطِ renderToPdf القيمة fontProvider: cjkPdfProvider: كلاهما يأخذ الملفات التي تحتوي حروف النص. الخطوط الصينية واليابانية والكورية →

  • لا يُبقي keep-all إلا الكسرات الموجودة في النص: لا يبحث Postext عن العبارات بنفسه، فالفراغات يكتبها المؤلف. والعبارة الأطول من السطر تنكسر من داخلها، في آخر موضع تسمح به قواعد الكينسوكو.
  • لا تفصل الصينية كلماتها أبدًا، ويساعد القارئ الصيني قارئ عمودي مع الـ zhuyin على اليمين قرّاءه الصغار بقراءات فوق الحروف؛ أما الكتاب المصوّر الياباني فلا يستعمل الكانجي، فلا يحتاج إلى الفوريغانا، وفراغات العبارات هي التي تقود القراءة.

الحقوق

الوصفة
Ignacio Ferro
النص
  • かみの ふね (The Paper Boat), a picture-book story in hiragana written for this recipe · Postext Cookbook · CC BY 4.0
الصور
  • The cover: a red paper boat on a river through green meadows, a clear sky on the right for the title · Generated With Diffusion Models · أصلي
  • Mii-chan folding the red paper boat at a low table by the window, after the rain · Generated With Diffusion Models · أصلي
  • Mii-chan waving goodbye to the boat on the stream · Generated With Diffusion Models · أصلي
  • A frog on a stone talking to the boat · Generated With Diffusion Models · أصلي
  • The boat under a wooden footbridge, little fish following it · Generated With Diffusion Models · أصلي
  • A white heron on the bank watching the boat on the wide river · Generated With Diffusion Models · أصلي
  • Dusk: a pink sky over the river mouth and the sea beyond · Generated With Diffusion Models · أصلي
  • Night: the full moon's reflection lighting the boat's way · Generated With Diffusion Models · أصلي
  • The boat at sea, greeted by seagulls · Generated With Diffusion Models · أصلي
  • Mii-chan at her window, looking towards the distant sea · Generated With Diffusion Models · أصلي
الخطوط
Klee One (SIL OFL 1.1) · Zen Maru Gothic (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
SandboxPDF