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

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

قصيدة في صفحة ديوان، كل بيت في شطرين

كتلة :::verse واحدة تنضّد أبيات المتنبي الستة والأربعين في عمودين من الأشطر، ويُمدّ كل شطر بالكشيدة إلى عرض واحد.

في هذه الصفحة
النوع
الشعر
المُخرَج
Canvas · PDF
المستوى
متوسط
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.28.0 · postext-pdf ≥ 1.28.0
الترخيص
حُدّثت في 11 أكتوبر 2026
الشيفرة MIT · النص MIT

ص ٢–٣ · 2–3 من 4

  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 170 × 240 مم
  • عمود واحد
  • Amiri 13/21
  • Aref Ruqaa
  • Noto Kufi Arabic
  • 4 صفحات
  • المستوى
  • Postext 1.57.1
  • أُخرجت في 97 ms
  • أسطر الشيفرة: 144

باختصار

قصيدة عربية قديمة مطبوعة كما تطبعها دواوين الشعر القديمة: ينقسم كل بيت إلى شطرين متجاورين، ويُمدّ الشطران إلى العرض نفسه، فتصطفّ نهاياتهما على طول الصفحة.

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

أربع صفحات من ديوان، أي مجموع شعر المتنبي، كما كانت مطابع القاهرة تنضّده قبل قرن: صفحة نصف عنوان عليها «ديوان» بخط الرقعة الأحمر، ثم القصيدة التي أنشدها بين يدي سيف الدولة سنة 954، تحت رأس زخرفي محدود بالأحمر. كل بيت من الأبيات الستة والأربعين سطر واحد من شطرين، الصدر على اليمين والعجز على اليسار، ممدودان بالكشيدة إلى عرض واحد، فتنزل القوافي المنتهية بـ ‑مُ على الحافة اليسرى في خط مستقيم. الكتاب مجلّد على اليمين، وأرقام الصفحات بالأرقام العربية المشرقية. ولا يتغير مع الطبعة إلا التعليق على النص في آخره. وتنضّد قصائد تانغ مقابل ترجمتها الإنجليزية الشعر الصيني القديم على شبكته الخاصة.

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

  • كيف أنضد الشعر العربي الكلاسيكي وكل بيت في شطرين؟

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

script.js · الأسطر 33–46في الشيفرة الكاملة
// In the Markdown, a :::verse block takes one bayt a line, the ṣadr and the ʿajuz parted
// by ||:
//   :::verse{style="bayt"}
//   عَلى قَدْرِ أهْلِ العَزْم تأتي العَزائِمُ || وَتأتي علَى قَدْرِ الكِرامِ المَكارمُ
//   :::
// The ṣadr goes on the right, the ʿajuz on the left, both stretched to the width of the
// widest half with a gap of 2 em between them. The style gives the poem its face and a
// leading deep enough for the harakat: 1.9 × the size.
const bayt = { id: 'bayt', fontFamily: NASKH, fontSize: pt(14), lineHeight: pt(26.6),
  color: col('ink'), marginTop: pt(LEAD / 2), marginBottom: pt(LEAD) };
// Justified lines lengthen their words with kashidas (tatweel) before they open the
// spaces wide: 'auto' is the default in an Arabic document, written out here to say so.
// A hemistich may stretch a word twice as far as a line of prose does: 1.2 em.
const bodyKashida = { kashida: 'auto', kashidaPatterns: 'naskh', kashidaMaxLength: 0.6 };

المكونات

تستخدم أيضًا
ترويسات لكل قسم
الخطوط
Amiri, Aref Ruqaa, Noto Kufi Arabic (SIL OFL 1.1)
الأصول
لا شيء: كل صورة مرسومة بالشيفرة

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

#1 · بيت في كل سطر، وشطراه بعرض واحد

الشيفرة هي الجواب المختصر أعلاه. داخل :::verse كل سطر بيت، ويفصل || بين الشطرين، فيُقرأ Markdown كنص ويكي مصدر الذي أُخذ منه (:::verse). تقيس القصيدة كل شطر، وتأخذ أعرض الأشطر عرضًا للعمودين (حتى نصف عرض السطر مطروحًا منه الفاصل)، وتملأ كل شطر إلى ذلك العرض، بالكشيدة أولًا ثم بالمسافات بين الكلمات (الشعر العمودي). يُنضَّد نمط bayt بحجم 14 pt على تباعد 26.6 pt، أي 1.9 مرة من الحجم، فلا تتلاقى الشدّات والكسرات في الأسطر المتجاورة (الحركات). مقاس القص 17 × 24 سم: على 14 × 21 سم لم يتسع ثلث الأبيات لنصف عرض السطر البالغ 104 مم، فرجعت إلى تخطيط متدرّج، الصدر والعجز كل منهما في سطر مستقل.

الصفحة 2: كل شطر ممدود إلى عرض أعرض الأشطر. الشطر القصير يأخذ كشيدات أكثر، فتنتهي كل قافية على الحافة اليسرى نفسها.

#2 · رأس زخرفي بخط الرقعة

script.js · الأسطر 50–68في الشيفرة الكاملة
const rule = (id, y, thickness) => ({ kind: 'rule', id, direction: 'horizontal',
  thickness: pt(thickness), color: col('rubric'),
  placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(y) },
    size: { width: 'fill' } } });
const opener = {
  enabled: true, minHeight: mm(46),
  slot: { elements: [
    { kind: 'box', id: 'band', reserve: false, style: { backgroundColor: col('tint') },
      placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(4) },
        size: { width: 'fill', height: mm(26) } } },
    rule('band-top', 4, 1.5), rule('band-foot', 30, 0.5),
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: RUQAA, fontWeight: 700,
      fontSize: pt(34), lineHeight: 1.1, align: 'center', color: col('rubric'),
      placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(7.5) } } },
    { kind: 'text', id: 'metre', content: '{attr.metre}', fontFamily: KUFI, fontWeight: 500,
      fontSize: pt(9), align: 'center', color: col('muted'),
      placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(35) } } },
  ] },
};

يرسم تصميم العنوانَ من المستوى الأول: إطار ملوّن محدود بالأحمر من أعلى وأسفل، والعنوان موسّط فوقه بخط Aref Ruqaa، وتحته البحر مأخوذًا من سمة العنوان {metre="من البحر الطويل"}. وحروف العرض بخط الرقعة لا تأخذ كشيدة، فيحتفظ العنوان بعرضه الطبيعي (ضبط الأسطر والكشيدة).

#3 · الترويسات على جانبي الورقة

script.js · الأسطر 95–109في الشيفرة الكاملة
// Running heads stay on the sheet's sides: in a book bound on the right the verso (even)
// is the right-hand page, so its outer edge, where the folio goes, is the right one.
const head = (id, content, parity, edge, x, extra = {}) => ({ kind: 'text', id, content,
  parity, pages: 'body', fontFamily: KUFI, fontWeight: 500, fontSize: pt(8.5),
  color: col('muted'), placement: { anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(12) } },
  ...extra });
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-right', -OUTER, { color: col('ink') }),
  head('verso-book', '{title}', 'even', 'top-right', -(OUTER + 10)),
  head('recto-rhyme', '{subtitle}', 'odd', 'top-left', OUTER + 10),
  head('recto-folio', '{pageNumber}', 'odd', 'top-left', OUTER, { color: col('ink') }),
] };
const footer = { elements: [head('drop-folio', '{pageNumber}', 'all', 'bottom', 0, {
  pages: 'opener', color: col('ink'),
  placement: { anchor: { to: 'page', edge: 'bottom' }, offset: { y: mm(-12) } } })] };

يجري النص من اليمين إلى اليسار، ويعني فيه اليسار واليمين البداية والنهاية. أما الترويسات فتبقى على جوانبها الفعلية. في كتاب مجلّد على اليمين تقع الصفحة الزوجية على يمين الصفحتين المتقابلتين، فيذهب رقمها إلى أعلى اليمين، ورقم الصفحة الفردية إلى أعلى اليسار: كلاهما على الحافة الخارجية (ترتيب الصفحات والتجليد على اليمين). ورمز اللغة locale: 'ar' وحده يضبط الاتجاه والتجليد والأرقام العربية المشرقية.

#4 · صفحة نصف عنوان لا شيء فيها من النص الجاري

script.js · الأسطر 72–91في الشيفرة الكاملة
const at = (y) => ({ anchor: { to: 'page', edge: 'top' }, offset: { y: mm(y) } });
const line = (id, content, y, style) => ({ kind: 'text', id, content, align: 'center',
  overflow: 'wrap', color: col('ink'), placement: at(y), ...style });
const titlePage = {
  id: 'title', span: 'page', runningChapter: false,
  breakBefore: { enabled: true, parity: 'any' },
  header: { elements: [] }, footer: { elements: [] },
  advancedDesign: { enabled: true, slot: { elements: [
    line('diwan', 'ديوان', 52, { fontFamily: RUQAA, fontWeight: 700, fontSize: pt(64),
      lineHeight: 1.2, color: col('rubric') }),
    line('poet', '{titleText}', 84, { fontFamily: NASKH, fontWeight: 700, fontSize: pt(20) }),
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.75),
      color: col('rubric'), placement: { anchor: { to: 'page', edge: 'top' },
        offset: { y: mm(100) }, size: { width: mm(24) } } },
    line('rhyme', '{attr.rhyme}', 106, { fontFamily: KUFI, fontWeight: 500, fontSize: pt(11),
      color: col('rubric') }),
    line('latin', '{attr.latin}', 150, { fontFamily: NASKH, fontSize: pt(9.5),
      color: col('muted'), italic: true }),
  ] } },
};

صفحة نصف العنوان نمط عنوان بـspan: 'page' وترويسة وتذييل فارغين خاصين به. نص عنوانها اسم الشاعر، فكلمة «ديوان» نص تصميم منضّد بحجم 64 pt فوقه، والسطر اللاتيني تحت القافية يأتي من السمة latin، التي تكتبها كل طبعة بلغتها.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 110 · A qasida on a diwan page, in two hemistichs ═══════════
// https://postext.dev/en/cookbook/qasida-diwan-page
// Code: MIT · Text: al-Mutanabbī, Dīwān, ar.wikisource (PD) · Pictures: none
// Fonts: Amiri, Aref Ruqaa, Noto Kufi Arabic (SIL OFL 1.1) · Needs postext ≥ 1.28.0
import { buildDocument, withLoadedFonts, renderPageToCanvas } from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'qasida-diwan-page';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text and red rubrics on a warm paper, as a Cairo diwan of the 1900s prints them.
const palette = {
  ink: '#1f1a16', // text: a warm near-black
  rubric: '#9a2b1f', // the accent: titles, the metre, the headpiece rules
  tint: '#f1e6cf', // the headpiece band
  rule: '#b8a27c', // hairlines
  muted: '#6b6156', // running heads and 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
const RUQAA = 'Aref Ruqaa'; // display: the titles
const KUFI = 'Noto Kufi Arabic'; // labels: metre, running heads, folios
const [SIZE, LEAD] = [13, 21]; // pt: the prose, at 1.6 × for a lightly vocalised headnote
const [OUTER, TOP] = [18, 23]; // mm: a 17 × 24 cm diwan

// #region answer: one bayt a line, both hemistichs stretched to one width
// In the Markdown, a :::verse block takes one bayt a line, the ṣadr and the ʿajuz parted
// by ||:
//   :::verse{style="bayt"}
//   عَلى قَدْرِ أهْلِ العَزْم تأتي العَزائِمُ || وَتأتي علَى قَدْرِ الكِرامِ المَكارمُ
//   :::
// The ṣadr goes on the right, the ʿajuz on the left, both stretched to the width of the
// widest half with a gap of 2 em between them. The style gives the poem its face and a
// leading deep enough for the harakat: 1.9 × the size.
const bayt = { id: 'bayt', fontFamily: NASKH, fontSize: pt(14), lineHeight: pt(26.6),
  color: col('ink'), marginTop: pt(LEAD / 2), marginBottom: pt(LEAD) };
// Justified lines lengthen their words with kashidas (tatweel) before they open the
// spaces wide: 'auto' is the default in an Arabic document, written out here to say so.
// A hemistich may stretch a word twice as far as a line of prose does: 1.2 em.
const bodyKashida = { kashida: 'auto', kashidaPatterns: 'naskh', kashidaMaxLength: 0.6 };
// #endregion

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

تنويعات

#علّم الفاصل بزخرفة

بعض الدواوين تطبع نجمة صغيرة بين الشطرين. يضع ornament علامة في وسط الفاصل دون أن يضيفها إلى النص.

-:::verse{style="bayt"}
+:::verse{style="bayt" ornament="٭"}

#أعطِ كل الأشطر العرض نفسه

يضبط width الثابت العمودين على قياس واحد في كل صفحات الديوان، أيًّا كان أعرض شطر في قصيدة بعينها.

-:::verse{style="bayt"}
+:::verse{style="bayt" width=58mm}

أخطاء شائعة

خطأ شائع

اوسم الكتاب العربي بـ 'ar'، لا بـ LANG

نسختا الوصفة هما 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 في ملف لكل مجموعة فرعية، والحروف العربية في ملف arabic. لا يجلب loadFonts إلا latin (وlatin-ext)، فيأتي النص العربي على الشاشة من خط النظام ويُقاس خطأً، ويسلّم fontsourceProvider ملف latin ذاك إلى PDF، فيطبع مربعات فارغة. اذكر كتلة الأدوات arabic، واستدعِ loadArabicFonts(FONTS, markdown) بعد loadFonts، مع ذكر كل وزن تضع به الصفحاتُ نصًا عربيًا في FONTS، وأعطِ renderToPdf القيمة fontProvider: arabicPdfProvider. الخطوط العربية →

الحقوق

الوصفة
Ignacio Ferro
النص
  • The qasida ʿAlā qadri ahli l-ʿazmi taʾtī l-ʿazāʾimu, as ar.wikisource gives it (revision 447620), with its vowels · al-Mutanabbī · ملك عام
  • The headnote in Arabic, the note on the text and the colophon · Postext Cookbook · أصلي
الخطوط
Amiri (SIL OFL 1.1) · Aref Ruqaa (SIL OFL 1.1) · Noto Kufi Arabic (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
SandboxPDF