かんたんな説明
アラビア語の古い物語を、文字の上下に付く小さな母音記号をすべて入れて印刷した例です。行の間隔を広く取り、ある行の記号が下の行にぶつからないようにします。
できあがり
すべての文字に母音を付けたアラビア語の古典の本、4ページです。収めるのはal-Hamadhānīの『精神病院のマカーマ』で、バスラの精神病院にいる狂人が神学者を言い負かし、最後に詩で自分の名を明かします。母音記号をすべて付けたテキストでは、文字の上にファトハとシャッダが重なり、下にカスラが付きます。これらの記号は行と行のあいだの空間に入ります。そこでページはAmiriの14 ptを、その2倍の28 ptの行送りで組み、ほかには何もしません。行送りそのものがデザインです。本文はカシーダで両端をそろえ、書き出しは右側に1.5 emの字下げを取り、3か所のクルアーンの引用は、印刷されたムスハフ(クルアーンの刊本)と同じ装飾括弧﴿ ﴾に入れます。版によって変わるのは、ラテン文字の題の行と本文についての注だけです。
このレシピが答える質問
- 完全に母音符号を付けたアラビア語には、どれくらいの行送りが必要ですか?
手短な答え
// Every letter of this maqāma carries its vowel: fatḥa and shadda over the letters, kasra
// and kasratān under them, often two marks on one letter. The marks sit in the leading,
// which never grows for them, so the leading is chosen for the most vocalised line of the
// book. Unvocalised prose sets well at 1.6 × the size; fully vocalised text needs
// 1.9–2.1 ×: here 14 pt on 28 pt, 2 ×, so a kasra hanging under one line clears a shadda
// standing on the line below. Any closer and the build reports the paragraph
// (arabicMarksExceedLeading) with the leading it would need.
const SIZE = 14; // pt
const LEAD = 2 * SIZE; // pt: 28
const bodyText = {
fontFamily: NASKH, fontSize: pt(SIZE), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
// Justified with kashidas, the default in an Arabic book, written out to say so:
// a line widens at its joins as well as at its spaces.
textAlign: 'justify', kashida: 'auto', kashidaPatterns: 'naskh',
firstLineIndent: em(1.5), indentAfterHeading: false, // on the start side, the right
optimalLineBreaking: true, avoidWidows: true, avoidOrphans: true,
};
材料
- 機能
- アラビア語のフォント本文の書体右から左のテキスト文書の言語としてのアラビア語字下げ、行そろえ、段落間隔カシーダによる両端そろえアラビア語の詩(2つの半句からなるバイト)右綴じの本逆方向の段落見出しの階層仕上がりサイズ見開きの余白用紙の色セマンティックカラーパレットキャンバス上のページ
- 種類
- Amiri, Aref Ruqaa (SIL OFL 1.1)
- 素材
- なし:画像はすべてコードで描画
作り方
#1 · 文字サイズの2倍の行送り
コードは上の手短な答えにあります。行送りは記号のために広がることはありません。ある行の下のカスラと次の行の上のシャッダは同じすきまを分け合うので、すきまは本の中で最も母音記号の多い行に合わせて決めます(母音記号)。このテキストでは、行送りを文字サイズの1.6倍にすると記号がぶつかる段落が6つ残り、1.9倍でもまだ1つ残ります。2倍ではぶつかる段落はありません。これはビルドが知らせてくれます。2つの行がぶつかると、その段落についてarabicMarksExceedLeadingを報告し、必要な行送りを示します(アラビア文字のテキスト)。

#2 · 小さなページに広い行長
// 166 mm of text block hold seventeen lines on the 28 pt pitch (9.88 mm). The measure is
// 106 mm, about twelve words of vocalised Naskh.
const page = {
sizePreset: 'custom', width: mm(140), height: mm(210), dpi: 150,
backgroundColor: col('paper'),
// mirror: left is the inner margin, at the spine (the right edge of an odd page here)
margins: { top: mm(22), bottom: mm(22), left: mm(18), right: mm(16), mirror: true },
};
14 × 21 cmのページに左右16 mmと18 mmの余白を取ると、行長は106 mmになります。母音記号付きの語がおよそ12語入り、28 ptの行送りで17行になります。記号のせいで行は灰色がかって見えるので、ページは簡素にとどめます。柱はなく、紙はクリーム色、赤は題1つだけです。mirror: trueは広いほうの余白を背の側に置きます。右綴じの本では、それは奇数ページの右端です(ページの順序と右綴じ)。
#3 · グリッドを崩さない題
// The headings carry no design: the title's line box, three lines of the grid deep, lowers
// it on the page (a top margin is dropped at the head of a page), and the levels under it
// keep to the 28 pt pitch, so the text starts on a line of the grid.
const headings = {
fontFamily: NASKH, color: col('ink'), textAlign: 'center',
levels: [
// The maqāma opens on a recto.
{ level: 1, fontFamily: RUQAA, fontWeight: 700, fontSize: pt(32), lineHeight: pt(LEAD * 3),
color: col('rubric'), marginTop: pt(0), marginBottom: pt(0),
breakBefore: { enabled: true, parity: 'odd' } },
{ level: 2, fontWeight: 700, fontSize: pt(15), lineHeight: pt(LEAD), color: col('ink'),
marginTop: pt(0), marginBottom: pt(0) },
{ level: 3, fontWeight: 400, fontSize: pt(10), lineHeight: pt(LEAD), color: col('muted'),
marginTop: pt(0), marginBottom: pt(LEAD) },
],
};
見出しにデザインはありません。ルクア体の題はグリッド3行分の深さの行ボックスに収まり、著者名とラテン文字の行はそれぞれ28 ptの1行を取るので、本文の1行目はグリッドの上に来ます。ラテン文字の行は{dir=ltr}で、右から左の本の中にある左から右の見出しです(文書、ブロック、インラインの方向)。
レシピの全体
// ═══ Postext Cookbook · Nº 111 · Fully vocalised classical prose with Qur'anic brackets ═══
// https://postext.dev/en/cookbook/vocalised-classical-prose
// Code: MIT · Text: al-Hamadhānī, Maqāmāt, ar.wikisource (PD) · Pictures: none
// Fonts: Amiri, Aref Ruqaa (SIL OFL 1.1) · Needs postext ≥ 1.28.0
import { buildDocument, withLoadedFonts, renderPageToCanvas } from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'vocalised-classical-prose';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text and a red title on a cream page, as the Beirut and Cairo editions of the
// Maqāmāt print them.
const palette = {
ink: '#211b17', // text: a warm near-black
rubric: '#94291d', // the accent: the title
muted: '#6b6156', // the author's name, the Latin title line, the note on the text
paper: '#fbf7ee', // a cream paper
};
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: 'rubric (defaults)', value: { hex: palette.rubric, model: 'hex' } },
];
const NASKH = 'Amiri'; // the text: a Bulaq Naskh, with its own Latin for the note
const RUQAA = 'Aref Ruqaa'; // display: the title
// #region answer: a leading of 2 × the size for text with every vowel written
// Every letter of this maqāma carries its vowel: fatḥa and shadda over the letters, kasra
// and kasratān under them, often two marks on one letter. The marks sit in the leading,
// which never grows for them, so the leading is chosen for the most vocalised line of the
// book. Unvocalised prose sets well at 1.6 × the size; fully vocalised text needs
// 1.9–2.1 ×: here 14 pt on 28 pt, 2 ×, so a kasra hanging under one line clears a shadda
// standing on the line below. Any closer and the build reports the paragraph
// (arabicMarksExceedLeading) with the leading it would need.
const SIZE = 14; // pt
const LEAD = 2 * SIZE; // pt: 28
const bodyText = {
fontFamily: NASKH, fontSize: pt(SIZE), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
// Justified with kashidas, the default in an Arabic book, written out to say so:
// a line widens at its joins as well as at its spaces.
textAlign: 'justify', kashida: 'auto', kashidaPatterns: 'naskh',
firstLineIndent: em(1.5), indentAfterHeading: false, // on the start side, the right
optimalLineBreaking: true, avoidWidows: true, avoidOrphans: true,
};
// #endregion
// #region page: a 14 × 21 cm book page, seventeen lines of 28 pt
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#読本用に母音記号を外す
tashkil: 'strip'は短母音とシャッダをレイアウトから外すので、同じテキストを文字サイズの1.6倍の行送りで組めます。'strip-vowels'はシャッダを残します。
- textAlign: 'justify', kashida: 'auto', kashidaPatterns: 'naskh',
+ textAlign: 'justify', kashida: 'auto', kashidaPatterns: 'naskh', tashkil: 'strip',#警告を見る
行送りを文字サイズの1.6倍にすると、ビルドはarabicMarksExceedLeadingの付いた段落を6つ報告し、それぞれに必要な行送りを示します。このテキストでは最大1.89 emです。
-const LEAD = 2 * SIZE; // pt: 28
+const LEAD = 1.6 * SIZE; // pt: 22.4よくあるつまずき
つまずき
アラビア語の本のタグは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を渡してください。 アラビア語のフォント →
レイアウト警告 · arabicMarksExceedLeading
母音記号が次の行に接触
原因. 母音符号付きのアラビア語の段落では、母音記号(ファトハ、カスラ、シャッダ、タンウィーン…)が行間に置かれ、行間は記号のために広がりません。ある行の単語の上の記号が、上の行の単語の下に垂れる文字や記号に届くと、2つの行が接してしまいます。
対処. `bodyText.lineHeight`を大きくする(部分的に母音符号を付けたテキストは1.7〜1.85em、完全に母音符号を付けた韻文は1.9〜2.1em)、行送りの大きい段落スタイルをその段落に与える、または母音符号なしの版にするなら`bodyText.tashkil: 'strip-vowels'`を設定してください。 ドキュメント →
クレジット
- 本文
- Al-Maqāma al-Māristāniyya, fully vocalised, as ar.wikisource gives it (revision 601165), with twenty typing slips corrected, its paragraphs divided and its Qurʾān quotations set between ﴿ ﴾ · Badīʿ al-Zamān al-Hamadhānī · パブリックドメイン
- The note on the text, the Latin title line and the colophon · Postext Cookbook · オリジナル
- フォント
- Amiri (SIL OFL 1.1) · Aref Ruqaa (SIL OFL 1.1)


