かんたんな説明
学校の菜園を題材にした、子ども向けアラビア語練習帳のページです。答えを選び、2列を線で結び、枠の言葉で空欄を埋め、正誤に印をつけ、言葉を並べ替え、文字の表から言葉を探します。
できあがり
学校の菜園を題材にした、アラビア語練習帳2年生用の1単元です。判型は17 × 24 cm。水彩画の帯で始まり、単元のタブと題名、名前・組・日付の点線が続きます。そのあとに、アラブの小学校の本が刷る練習が並びます。أ) ب) ج)を1行に3つ並べて正しい答えを選ぶ問題、2列を線で結ぶ問題、語群の枠から空欄を埋める問題、صحかخطأに印をつける問題、言葉を並べ替えて文を線の上に書く問題、文字の表から菜園の言葉を7つ探す問題です。単元の最後に解答が付きます。同じ本文を2回組みます。マシュリク版は番号をすべてアラビア・インド数字١ ٢ ٣で、マグリブ版はヨーロッパ数字で刷ります。どちらも右から読み、右綴じです。
このレシピが答える質問
- アラビア語の練習帳を右から左に組むには?(線つなぎ、語群、ワードサーチ、アラビア・インド数字)
- 丸数字、語群、正誤問題、線結びのあるワークブックのページはどう組む?
- 語のリストから単語探しやクロスワードを作るには?
手短な答え
// The locale sets the direction, the binding and the digits: 'ar' writes the exercise
// numbers, the items and the key in Arabic-Indic digits (١ ٢ ٣), 'ar-MA' in European ones.
// Options take the abjad letters (أ ب ج), true/false the words صح / خطأ, both from the
// language. Nothing below names a side: the engine sets every part from the right.
const tamrin = {
id: 'tamrin',
number: { shape: 'disc', fontFamily: LABEL, background: col('accent') },
instruction: { fontFamily: LABEL, bold: false, color: col('ink') },
options: { layout: 'row' }, // أ) ب) ج) side by side, three to a row (columns=3)
blank: { look: 'dots', color: col('muted') }, // a dotted line, as Arab workbooks print it
match: { color: col('accent') },
bank: { box: 'sunduq', order: 'shuffle' },
area: { kind: 'lines', color: col('rule') },
grid: { fontFamily: TEXT, rule: col('leaf'), uppercase: false }, // Arabic has no capitals
answers: { color: col('leaf'), fontFamily: TEXT },
solutions: { box: 'hulul' },
marginTop: em(1.1), marginBottom: em(0.5),
};
// The solutions where :::solutions stands: at the end of the unit.
const exercises = { solutions: { placement: 'directive' } };
材料
- 機能
- 練習問題右から左のテキスト生成される番号の数字練習問題のスタイル選択問題と正誤問題穴埋めと語群線結びと分類並べ替え単語探しとクロスワード解答アラビア語のフォントアラビア語の番号スタイル右綴じの本インラインのチップ囲みデザインした章扉見出しの属性ページデザインの画像セマンティックカラーパレットPDFの書き出し
- 種類
- Noto Naskh Arabic, Baloo Bhaijaan 2 (SIL OFL 1.1)
- 素材
garden-1600.jpg- A school garden in an Arab town: date palms, a fountain, lemon trees, a girl watering plants and a boy carrying a pot of mint. (Generated With Diffusion Models, オリジナル)
作り方
#1 · 左右を書かない
コードは上の手短な答えにあります。locale: 'ar'で本文は右から左へ流れ、本は右綴じになり、数字も決まります。練習のスタイルは、選択肢のアブジャド文字と正誤のصحとخطأを言語から取ります。線で結ぶ2列、語群の枠、単語探し、書き込み線は枠のデザインとして描くので、右から左のページでは鏡像になります。最初の列は右に立ち、表を横に読む言葉は右から左へ進み、結ぶ点は中央で向かい合います。
#2 · 菜園の扉
const BAND = 170 / 2.4; // mm: the painting's height at the page's width
const opener = { enabled: true, minHeight: mm(BAND - 20 + 21), slot: { elements: [
{ kind: 'image', id: 'picture', resourceId: '{attr.pic}', decorative: true, reserve: false,
placement: { anchor: { to: 'page', edge: 'top-left' },
size: { width: mm(170), height: mm(BAND) } } },
// In the flow of a right-to-left page 'left' is the start of the line: the right.
{ kind: 'text', id: 'unit', content: '{attr.kicker}', fontFamily: LABEL, fontSize: pt(11),
fontWeight: 700, color: col('paper'), align: 'left',
box: { backgroundColor: col('accent'), borderRadius: mm(1.5),
padding: { top: mm(0.6), bottom: mm(0.4), left: mm(2.4), right: mm(2.4) } },
placement: { anchor: { to: 'container', edge: 'top-left' },
offset: { x: mm(0), y: mm(BAND - 20 + 3) } } },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: LABEL, fontSize: pt(30),
fontWeight: 700, color: col('ink'), align: 'left',
placement: { anchor: { to: '#unit', edge: 'right-of' }, offset: { x: mm(4), y: mm(-5) } } },
] } };
絵はページに固定され、位置を保ちます。タブと題名はページの流れの中に置きます。そこではleftが行頭を指すので、自分の座標を持たなくても右側に立ちます。ノンブルは柱と同じく物理的なページに置き、左右をそれぞれ指定します。
#3 · 2つの版、2種類の数字
// Both are bound on the right and read from the right; only the locale changes.
const build = () => withLoadedFonts(() => buildDocument({ markdown, resources }, config()),
{ ...kitFonts(FONTS), text: markdown });
const mashriq = await build();
edition = { locale: 'ar-MA' }; // the same book for Morocco: European digits, still right to left
const docs = [mashriq, await build()];
設定は関数なので、組むたびに別のオブジェクトができ、2回目はロケールだけを変えます。ar-MAは練習番号、小問、解答、ノンブルをヨーロッパ数字で書きます。文字の向き、綴じ、アブジャド文字、解答の言葉はそのままです。
レシピの全体
// ═══ Postext Cookbook · Nº 173 · An Arabic workbook, right to left ═══════════════
// https://postext.dev/en/cookbook/arabic-workbook-rtl
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Noto Naskh Arabic, Baloo Bhaijaan 2 (SIL OFL 1.1) · Needs postext ≥ 1.59.0
import {
buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'ar'; // @lang: the language of the frame; the workbook is Arabic in all
const RECIPE = 'arabic-workbook-rtl';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a garden workbook: ink, a terracotta accent, a leaf green, sand
const palette = {
ink: '#22282e', // text
accent: '#b9542a', // the one accent: exercise numbers, the unit tab, the word bank
leaf: '#4f7d3a', // the second: rules and the word search's ruling
sand: '#f8eedf', // the bank's ground, the answers box
rule: '#c8b49b', // writing lines
muted: '#6f655c', // folios, the name line, the colophon
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.accent, model: 'hex' } },
];
// #endregion
// Naskh for the text, a rounded Arabic for the labels a child reads first.
const [TEXT, LABEL] = ['Noto Naskh Arabic', 'Baloo Bhaijaan 2'];
// #region answer: one exercise style read right to left, in the edition's digits
// The locale sets the direction, the binding and the digits: 'ar' writes the exercise
// numbers, the items and the key in Arabic-Indic digits (١ ٢ ٣), 'ar-MA' in European ones.
// Options take the abjad letters (أ ب ج), true/false the words صح / خطأ, both from the
// language. Nothing below names a side: the engine sets every part from the right.
const tamrin = {
id: 'tamrin',
number: { shape: 'disc', fontFamily: LABEL, background: col('accent') },
instruction: { fontFamily: LABEL, bold: false, color: col('ink') },
options: { layout: 'row' }, // أ) ب) ج) side by side, three to a row (columns=3)
blank: { look: 'dots', color: col('muted') }, // a dotted line, as Arab workbooks print it
match: { color: col('accent') },
bank: { box: 'sunduq', order: 'shuffle' },
area: { kind: 'lines', color: col('rule') },
grid: { fontFamily: TEXT, rule: col('leaf'), uppercase: false }, // Arabic has no capitals
answers: { color: col('leaf'), fontFamily: TEXT },
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
よくあるつまずき
つまずき
アラビア語の本のタグはLANGではなく'ar'にする
レシピの版はenとesですが、アラビア語のサンプルはどちらの版でもアラビア語です。`locale: LANG`では左から右に組まれ、左綴じになり、ページ番号は1 2 3となり、図のキャプションにはFigureやFiguraが付きます。postext 1.30以降、このタグはテキストを組む言語(計測、描画、埋め込みに使う言語)でもあるので、英語やスペイン語のタグでは、Markazi Textのようなフォントがギュメ(« »)や終止符をアラビア語の字形で描かず、改行の位置も変わります。タグは自分で書いてください。'ar'(アラビア・インド数字、マシュリク地域の慣習)、'ar-EG'や'ar-SA'のような地域付きのタグ、ヨーロッパ式数字を使うマグレブ版なら'ar-MA'、'ar-DZ'、'ar-TN'です。アラビア語を引用するだけのラテン文字のページは、自分のロケールのままにします。 右から左のテキスト →
つまずき
アラビア語の書体にはarabicブロックを通じてarabicファイルが必要
FontsourceはAmiri、Noto Naskh Arabic、Scheherazade Newをサブセットごとに1ファイルとして配信し、アラビア文字はarabicファイルに入っています。loadFontsが取得するのはlatin(とlatin-ext)だけなので、画面ではアラビア文字がシステムの書体で出て計測が狂い、fontsourceProviderはPDFにそのlatinファイルを渡すため、空の四角が印字されます。キットのarabicブロックを挙げ、loadFontsのあとにloadArabicFonts(FONTS, markdown)を呼び(ページでアラビア文字に使うすべてのウェイトをFONTSに挙げておきます)、renderToPdfにfontProvider: arabicPdfProviderを渡してください。 アラビア語のフォント →
- アラビア語の書体の多くには✓も✗もありません。正誤の言葉はصحとخطأで、指示文は枠に印をつけるよう求めます。
- 単語探しは、空いたマスを自分の言葉の文字で、独立形のまま埋めます。文字の種類が多い言葉を選ばないと、表がةだらけになります。
クレジット
- 本文
- 書き下ろしの文章, CC BY 4.0
- 画像
- A school garden in an Arab town: date palms, a fountain, lemon trees, a girl watering plants and a boy carrying a pot of mint. · Generated With Diffusion Models · オリジナル
- フォント
- Noto Naskh Arabic (SIL OFL 1.1) · Baloo Bhaijaan 2 (SIL OFL 1.1)


