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

دليل الوصفات · الفصل 12 · الكتب المدرسية

كراسة تمارين يابانية حلولها مطبوعة مقلوبة

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

في هذه الصفحة
المُخرَج
Canvas · PDF
المستوى
متوسط
Postext
اختُبرت مع Postext 1.59.0
تتطلب ≥ 1.59.0 · postext-pdf ≥ 1.59.0
الترخيص
حُدّثت في 24 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج بلغة أجنبية: لا توجد طبعة عربية بعد
  • مقاس القص 182 × 257 مم
  • عمود واحد
  • Klee One 12/22
  • Zen Maru Gothic
  • 4 صفحات
  • المستوى
  • Postext 1.59.0
  • أُخرجت في 105 ms
  • أسطر الشيفرة: 137

باختصار

كراسة تمارين مدرسية يابانية: عمليات حسابية ومربعات للأعداد واختيار من متعدد وصواب أو خطأ في صفحة، وكانجي وقراءات من أعلى إلى أسفل في صفحة أخرى. تحت كل تمرين حلوله مطبوعة مقلوبة، فيقلب الطفل الكراسة ليتحقق منها.

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

صفحتان من سلسلة كراسات تمارين للصف الثالث بقياس B5. صفحة الحساب أفقية: شريط أزرق فاتح عليه شارة المادة والعنوان وتانوكي تميمةً للسلسلة، وسطر للاسم وخانة للدرجة، ثم ひっ算 (العمليات المكتوبة رأسيًا) بمربع لكل رقم من الناتج، ومربعات بعد ست عمليات، واختيارات ア イ ウ في صف، وعبارات ○× بقوس في آخر السطر، ومسألتان كلاميتان بأسطر لكتابة الحل. وصفحة الكانجي منضدة كما تُطبع كراسة 国語، من أعلى إلى أسفل ومن اليمين إلى اليسار: قراءات بجانب كل منها مربع للكانجي، وكلمات تحتها خط تُكتب قراءتها بين قوسين، واختيارات يُحاط الصحيح منها بدائرة، ومعنى يُنتقى. وتحت كل تمرين تُطبع حلوله مقلوبة بخط رمادي صغير. يرى الطفل مكانها، ولا يقرؤها بنظرة عابرة، ويقلب الكراسة ليتحقق منها.

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

  • كيف أطبع الإجابات مقلوبة أسفل التمرين؟
  • كيف أصفّ صفحة تدريبات يابانية في أعمدة عمودية بالتصميم نفسه للصفحة الأفقية؟
  • كيف أصفّ القسمة الطويلة كما تكتبها مدارس كل بلد؟

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

script.js · الأسطر 35–55في الشيفرة الكاملة
// `placement: 'inverted'` sets each exercise's key right after it in a box turned 180°: the
// pupil sees where the answers are without reading them, and turns the book to check. The
// key's words come from the exercise (the options' katakana, ○ and ×, the operations), so
// the Markdown holds nothing twice.
const drill = {
  id: 'drill',
  number: { shape: 'square', fontFamily: TEXT, fontWeight: 600, background: col('blue') },
  instruction: { fontFamily: ROUND, bold: false },
  options: { layout: 'row' }, // ア イ ウ side by side (the default labels in Japanese)
  trueFalse: { look: 'bracket' }, // ( ) for ○ or ×
  blank: { look: 'box', width: 'answer', color: col('rule') }, // □ to write in
  area: { kind: 'lines', color: col('rule') },
  grid: { rule: col('rule') },
  solutions: { placement: 'inverted', box: 'kotae' },
  marginTop: em(1.1), marginBottom: em(0.4),
};
const kotae = { id: 'kotae', title: '', backgroundEnabled: false, border: { enabled: false },
  padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
  body: { fontFamily: ROUND, fontSize: pt(8), lineHeight: pt(12), color: col('muted'),
    firstLineIndent: pt(0) },
  marginTop: mm(1), marginBottom: mm(2), keepTogether: true };

المكونات

الخطوط
Klee One, Zen Maru Gothic (SIL OFL 1.1)
الأصول
  • kitsune-600.jpg
  • tanuki-600.jpg
  • A young tanuki in a yellow school hat holding a big pencil. (Generated With Diffusion Models, أصلي)
  • A fox cub in a red scarf reading a book. (Generated With Diffusion Models, أصلي)

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

#1 · اقلب حلول كل تمرين

الشيفرة هي الجواب المختصر أعلاه. يضع placement: 'inverted' حلول كل تمرين بعده في إطار مُدار 180°، ويقع هذا الإطار داخل إطار التمرين نفسه، فلا يفصل بينهما فاصل صفحة أبدًا. تُستخرج الحلول من التمرين: العمليات مع نواتجها، وحرف الكاتاكانا للخيار الصحيح، و○ و×، وكلمات الفراغات. أما نمط إطار الحلول، kotae، فلا يفعل سوى تصغير الخط وتلوينه بالرمادي.

#2 · شريط واحد لصفحة أفقية وأخرى عمودية

script.js · الأسطر 59–76في الشيفرة الكاملة
// A heading design on a vertical page is laid along its column: x runs down the page and y
// to the left, so the same band stands at the right edge, from head to foot.
const BAND = 30; // mm: the band's depth (its height across, its width down)
const header = { enabled: true, minHeight: mm(BAND + 3), slot: { elements: [
  { kind: 'box', id: 'band', reserve: false, style: { backgroundColor: col('tint'),
    borderRadius: mm(4) }, placement: { anchor: { to: 'container', edge: 'top-left' },
    size: { width: 'fill', height: mm(BAND) } } },
  { kind: 'image', id: 'mascot', resourceId: '{attr.pic}', decorative: true, reserve: false,
    placement: { anchor: { to: 'container', edge: 'top-right' }, offset: { x: mm(-4), y: mm(1) },
      size: { width: mm(28), height: mm(28) } } },
  { kind: 'text', id: 'subject', content: '{attr.kicker}', fontFamily: ROUND, fontSize: pt(10),
    fontWeight: 700, color: col('ink'), box: { backgroundColor: col('sun'), borderRadius: mm(3),
      padding: { top: mm(0.6), bottom: mm(0.6), left: mm(2.4), right: mm(2.4) } },
    placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { x: mm(5), y: mm(5) } } },
  { kind: 'text', id: 'title', content: '{titleText}', fontFamily: ROUND, fontSize: pt(20),
    fontWeight: 700, color: col('ink'),
    placement: { anchor: { to: '#subject', edge: 'below' }, offset: { x: mm(0), y: mm(2.5) } } },
] } };

يمتد تصميم العنوان في الصفحة العمودية على طول عموده: يتجه x إلى أسفل الصفحة، ويتجه y إلى اليسار. فالشريط المثبت عند top-left بالعرض كله يقف أعلى صفحة الحساب، وعلى الحافة اليمنى في صفحة الكانجي؛ والتميمة المثبتة عند top-right تقع عند الطرف الآخر من الشريط في الصفحتين. ولا شيء في التصميم يسمّي اتجاهًا.

#3 · كراستان من نص واحد

script.js · الأسطر 271–279في الشيفرة الكاملة
// Two drill books of one series: arithmetic across, bound on the left; kanji in columns,
// bound on the right (vertical text binds there by itself).
const [sansu, kokugo] = markdown.split(/(?=^# 春のことば)/m);
const build = (text) => withLoadedFonts(() => buildDocument({ markdown: text, resources },
  config()), { ...kitFonts(FONTS), text: markdown });
const across = await build(sansu);
// 国語 is set in columns, top to bottom, right to left: the same design, turned.
writingMode = 'vertical-rl';
const docs = [across, await build(kokugo)];

الإعداد دالة، فيحصل كل تنضيد على كائنه الخاص، ولا يتغير بين الاثنين إلا writingMode. وحين تُنضد كراسة 国語 عموديًا تُجلَّد على اليمين من تلقاء نفسها؛ ويضع showBook كل كراسة في جهتها من كعب الكتاب. النص بخط Klee One، وهو خط كتب مدرسية، والتسميات بخط Zen Maru Gothic؛ ويحمّل الخطان علامات ترقيمهما العمودية لأقواس صفحة الكانجي.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 172 · A Japanese drill with the answers upside down ═══
// https://postext.dev/en/cookbook/japanese-drill-upside-down-answers
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Klee One, Zen Maru Gothic (SIL OFL 1.1) · Needs postext ≥ 1.59.0
import {
  buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage,
  loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'ja'; // @lang: the language of the frame; the drill is Japanese in all
const RECIPE = 'japanese-drill-upside-down-answers';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a drill book's blue, a warm yellow and a pale sky for the band
const palette = {
  ink: '#23272c', // text
  blue: '#2a6cb0', // the accent: exercise numbers, the title band's rule, the score box
  sun: '#f2c14e', // the subject badge
  tint: '#eaf2fb', // the title band
  rule: '#a8bfd8', // writing lines and boxes
  muted: '#69717b', // folios, the name line, the upside-down answers
  paper: '#ffffff',
};
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.blue, model: 'hex' } },
];
// #endregion
// 教科書体 for the text a child copies from, a round gothic for the labels.
const [TEXT, ROUND] = ['Klee One', 'Zen Maru Gothic'];

// #region answer: the answers printed upside down under each exercise
// `placement: 'inverted'` sets each exercise's key right after it in a box turned 180°: the
// pupil sees where the answers are without reading them, and turns the book to check. The
// key's words come from the exercise (the options' katakana, ○ and ×, the operations), so
// the Markdown holds nothing twice.
const drill = {
  id: 'drill',
  number: { shape: 'square', fontFamily: TEXT, fontWeight: 600, background: col('blue') },
  instruction: { fontFamily: ROUND, bold: false },
  options: { layout: 'row' }, // ア イ ウ side by side (the default labels in Japanese)
  trueFalse: { look: 'bracket' }, // ( ) for ○ or ×
  blank: { look: 'box', width: 'answer', color: col('rule') }, // □ to write in
  area: { kind: 'lines', color: col('rule') },
  grid: { rule: col('rule') },
  solutions: { placement: 'inverted', box: 'kotae' },

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

تنويعات

#اجمع الحلول في النهاية

الكراسة التي يصحبها كتيّب حلول منفصل تُبقي الحلول خارج صفحاتها: يسردها chapterEnd بعد آخر تمرين.

-  solutions: { placement: 'inverted', box: 'kotae' },
+  solutions: { placement: 'chapterEnd', box: 'kotae' },

#نضّد صفحة ألغاز

صفحة الألغاز تقلب حلولها بالطريقة نفسها، على بطاقات في عمودين.

أخطاء شائعة

خطأ شائع

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

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

خطأ شائع

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

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

  • لا يمكن بعدُ أن تقف القراءة فوق فراغ: فالـruby داخل [[…]] جزء من الإجابة المخفية. يضع تمرين 漢字の書き取り كل قراءة في سطر خاص بها والمربع بعدها، ثلاثة في كل صف داخل مجموعة :::columns؛ وفي الصفحة العمودية تقف القراءة بجانب المربع، كما يفعل الفوريغانا.
  • لا يأتي Klee One إلا بالوزنين 400 و600: يُبقي boldFontWeight: 600 كل نص عريض في قطع موجود فعلًا، بما في ذلك أرقام البنود وأرقام التمارين.

الحقوق

الوصفة
Ignacio Ferro
النص
نص أصلي, CC BY 4.0
الصور
  • A young tanuki in a yellow school hat holding a big pencil. · Generated With Diffusion Models · أصلي
  • A fox cub in a red scarf reading a book. · Generated With Diffusion Models · أصلي
الخطوط
Klee One (SIL OFL 1.1) · Zen Maru Gothic (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
Sandbox