باختصار
مختارات صغيرة تبدأ بأباي وتتابع بقصائد بالقرغيزية والتتارية والبشكيرية والمنغولية والطاجيكية. تُشرح الكلمات الصعبة بالكازاخية في أسفل كل صفحة، والزخارف مأخوذة من بسط اللباد في السهوب.
ما الذي ستنضده
«Дала үні» (صوت السهوب) كتيّب قياسه 145 × 215 مم في ثماني صفحات. الغلاف بساط لباد من بلاطات قرون الكبش، فوق العنوان والفهرس. تملأ «الكلمة الأولى» لأباي والمقطع الأول من «ثمانياته» صفحتين متقابلتين، ثم تأخذ قصيدة بالقرغيزية وأخرى بالتتارية والبشكيرية والمنغولية والطاجيكية صفحة لكل منها، تحت لوح بلون الشاعر فيه الرقم الروماني والعنوان والاسم والتواريخ واللغة. وتُشرح الألفاظ القديمة والأجنبية بالكازاخية في أسفل الصفحة. النص بخط Alegreya والعناوين بخط Piazzolla. ولا يتبع لغة الطبعة سوى بيانات النشر الختامية.
تجيب هذه الوصفة عن
- كيف أنضد مختارات بالكازاخية والقرغيزية والتتارية والبشكيرية والمنغولية والطاجيكية؟
الجواب المختصر
// The book is Kazakh: its hyphenation, the ties (a dash opens no line, a number keeps its unit)
// and its notes, which start again on every page with an indent of 1.5 em.
const LOCALE = 'kk';
// A poem in another language is a :::verse block that names it: the poem is shaped by that
// language and tagged with it in the PDF and the HTML, :::verse{lang=ky}.
// ky Kyrgyz, tt Tatar, ba Bashkir, mn Mongolian, tg Tajik. Two spaces at the head of a line
// draw it in, as in the third and sixth lines of «Сегіз аяқ».
const verse = { align: 'center', hang: em(2), keepStanzas: 8 }; // bodyText.verse
const bodyText = {
fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('red'),
textAlign: 'justify', firstLineIndent: em(1.5), minWordSpacing: 0.75, maxWordSpacing: 1.7,
maxJustifyTracking: 15,
hyphenation: { leftMin: 2, rightMin: 2 }, verse,
};
// The glosses are Kazakh, whatever the language of the word: жеме — сөгіс, кінә.
const footnotes = { fontFamily: TEXT, fontSize: pt(8.8), lineHeight: pt(11.5),
color: col('muted'), separator: { enabled: true, width: 0.2, lineWidth: pt(0.6),
color: col('gold') } };
المكونات
- الميزات
- اللغات الكيريلية لغةً للمستندالشعر سطرًا سطرًاالحواشي السفليةكلمات لا تُفصل عند نهاية السطرتقسيم الكلمات ولغة المستندجدول المحتوياتالعناوين المرقّمةصفحات افتتاح مصمَّمةأنماط العناوينسمات العنوانالصور في تصاميم الصفحةالنصوص والخطوط والمربعات في تصاميم الصفحةالترويسات وأرقام الصفحاتالأغلفة وصفحات العنوان وبيانات النشرالبيانات الوصفية للمستندفصول بلا أرقامهوامش متناظرةالمسافات البادئة والمحاذاة والتباعد بين الفقراتلوحة ألوان دلاليةالتصدير إلى PDF
- تستخدم أيضًا
- لون الورقأنماط الفقراتالخطوط المضمَّنة في PDFالأشكال والجداول بوصفها مواردترويسات لكل قسم
- الخطوط
- Alegreya, Alegreya Sans, Piazzolla (SIL OFL 1.1)
- الأصول
- لا شيء: كل صورة مرسومة بالشيفرة
طريقة التحضير
#1 · كتاب كازاخي فيه قصائد بخمس لغات أخرى
الشيفرة هي الجواب المختصر أعلاه. يمنح locale: 'kk' الكتاب تقطيعه وكلماته المتلازمة وحواشيه، التي تُرقّم من جديد في كل صفحة وبمسافة بادئة 1,5 em. وكل قصيدة من القصائد الأخرى كتلة :::verse{lang=ky}، تُنضد بلغتها وتُوسم بها في PDF وHTML. ويوسّط align: 'center' القصيدة على أطول أبياتها، ويبقي keepStanzas: 8 المقطع في صفحة واحدة، وتزيح مسافتان في أول البيت البيتَ إلى الداخل.
#2 · لوح لباد بلون الشاعر
// # Үлгү ырлар {tone="blue" author="Тоқтоғұл Сатылғанов" when="1864–1933" tongue="қырғызша"}
const PANEL = 56; // mm: the panel's height, from the head of the page
const opener = { enabled: true, minHeight: mm(PANEL - TOP + 8), slot: { elements: [
image('panel', 'panel-{attr.tone}', { ...at('page', 'top-left'), size: { width: mm(TRIM_W) } }),
text('number', '{number}', DISPLAY, 17, 700, 'cream', at('container', 'top-left', 0, -10)),
text('title', '{titleText}', DISPLAY, 21, 800, 'cream',
{ ...at('container', 'top-left', 0, -2.5), ...fill }),
text('author', '{attr.author}', SANS, 12, 700, 'cream', at('container', 'top-left', 0, 11)),
text('when', '{attr.when} · {attr.tongue}', SANS, 11, 400, 'cream',
{ ...at('container', 'top-right', 0, 11.3) }, { align: 'right' }),
] } };
// A second piece by the same poet goes on in the page, under a narrower border.
const runOn = { id: 'run-on', breakBefore: { enabled: false }, marginTop: pt(LEAD),
marginBottom: pt(0), advancedDesign: { enabled: true, minHeight: pt(3.6 * LEAD), slot: {
elements: [
image('strip', 'strip', { ...at('container', 'top-left'), ...fill }),
text('number', '{number}', DISPLAY, 13, 700, 'red', at('container', 'top-left', 0, 9)),
text('title', '{titleText}', DISPLAY, 17, 800, 'red',
at('container', 'top-left', 9, 7.8)),
text('tongue', '{attr.tongue}', SANS, 10, 400, 'muted',
at('container', 'top-right', 0, 10), { align: 'right' }),
] } } };
يحمل العنوان ما يطبعه اللوح: # Үлгү ырлар {tone="blue" author="Тоқтоғұл Сатылғанов" when="1864–1933" tongue="қырғызша"}. يسمّي panel-{attr.tone} الرسم، فيخدم تصميم واحد أربعة ألوان، ويصل author نفسه إلى الفهرس وتذييل الصفحة. ويكتب numberingTemplate: '{1:I}' الرقم الروماني. أما النص الثاني للشاعر نفسه فله النمط run-on، بلا فاصل صفحة وبحافة ضيقة.
#3 · الفهرس على الغلاف
const none = { numbered: false, toc: false, header: { elements: [] }, footer: { elements: [] } };
const RUG = 2 * (TRIM_W / 4); // mm: two rows of four tiles
const cover = { id: 'cover', ...none, marginBottom: pt(0), advancedDesign: { enabled: true,
minHeight: mm(RUG - TOP + 41), slot: { elements: [
image('rug', 'rug', { ...at('page', 'top-left'), size: { width: mm(TRIM_W) } }),
text('title', '{titleText}', DISPLAY, 42, 800, 'red',
at('page', 'top-left', INNER, RUG + 9)),
text('subtitle', '{subtitle}', SANS, 13, 400, 'ink', at('#title', 'below', 0, 0.5)),
] } } };
const toc = {
levels: [{ level: 1, fontFamily: DISPLAY, fontSize: pt(11), color: col('ink'),
numberFontWeight: 700, numberColor: col('red'), numberWidth: mm(8), numberGap: mm(2),
marginBottom: pt(2.5) }],
pageNumber: { fontFamily: SANS, fontSize: pt(10), fontWeight: 700, color: col('red'),
width: mm(5) },
leader: { char: '. ', gap: mm(2) },
subtitle: { enabled: true, attr: 'author', italic: false, fontFamily: SANS, fontSize: pt(9),
color: col('muted') },
};
يحجز عنوان الغلاف مكان البساط والعنوان بـminHeight، ويتبعه :::toc في تدفق النص. ويطبع toc.subtitle خاصية author لكل عنوان تحته. والغلاف نفسه لا يُرقّم ولا يُدرج.
#4 · قرون الكبش من أنصاف دوائر
// A pair of horns is two half circles a side, radius 10 and then 6, on a stem; four pairs round
// a diamond make the tile, and a row of pairs, one up and one down, the border. The width of
// the stroke leaves as much ground as wool, so either colour can be read as the figure.
const horn = (side, sweep) => `M50 20 A10 10 0 0 ${sweep} ${50 + side * 20} 20 `
+ `A6 6 0 0 ${sweep} ${50 + side * 8} 20`;
const pair = `M50 40 V20 ${horn(-1, 0)} ${horn(1, 1)}`;
const horns = (colour, turn, w = 5.6) => `<path d="${pair}" transform="${turn}" fill="none" `
+ `stroke="${colour}" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round"/>`;
const shape = (d, colour, turn = '') => `<path d="${d}" fill="${colour}" transform="${turn}"/>`;
const tile = (x, y, ground, wool, spark) => `<g transform="translate(${x} ${y})">`
+ shape('M0 0H100V100H0Z', ground)
+ [0, 90, 180, 270].map((a) => horns(wool, `rotate(${a} 50 50)`)
+ shape('M0 0H17L0 17Z', spark, `rotate(${a} 50 50)`)).join('')
+ shape('M50 35L65 50L50 65L35 50Z', wool) + shape('M50 43L57 50L50 57L43 50Z', spark)
+ '</g>';
const UNIT = 50; // a pair of horns and its gap, in the border's units
const border = (n, colour, y) => Array.from({ length: n }, (_, i) => horns(colour, i % 2
? `translate(${i * UNIT - 25} ${y + 43}) scale(1 -1)`
: `translate(${i * UNIT - 25} ${y - 3})`)).join('');
const teeth = (n, step, y, h, colour) => shape(Array.from({ length: n }, (_, i) =>
`M${i * step} ${y}h${step}l${-step / 2} ${h}Z`).join(''), colour);
const svg = (w, h, body) => ({ width: w, height: h, markup: `<svg xmlns="http://www.w3.org/2000/`
+ `svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">${body}</svg>` });
const { cream, gold } = palette;
const panel = (tone) => svg(600, 231.7, // the trim's width, 12 pairs of horns
shape('M0 0H600V231.7H0Z', palette[tone]) + border(12, cream, 174)
+ shape('M0 160H600V163H0Z', cream) + teeth(48, 12.5, 222.7, 9, gold));
const rug = ['red', 'blue', 'green', 'ochre', 'blue', 'ochre', 'red', 'green'];
const ART = {
rug: svg(400, 200, rug.map((tone, i) => tile((i % 4) * 100, Math.floor(i / 4) * 100,
palette[tone], cream, gold)).join('')),
strip: svg(1000, 60, shape('M0 0H1000V60H0Z', palette.red) + border(20, cream, 10)),
...Object.fromEntries(['red', 'blue', 'green', 'ochre']
.map((tone) => [`panel-${tone}`, panel(tone)])),
};
القرن نصفا دائرة، نصف قطر الأول 10 والثاني 6، على ساق مشتركة. أربعة أزواج تدور حول معيّن تصنع البلاطة، وصف من الأزواج، واحد إلى أعلى وآخر إلى أسفل، يصنع الحافة. وعرض الخط قريب من عرض الفراغ، كما في الشيرداك حيث تُقص كل قطعة لباد لتطابق الأخرى.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 210 · A Kazakh anthology of six languages of the steppe ═══
// https://postext.dev/en/cookbook/abai-kazakh-anthology
// Code: MIT · Text: Abai, Toktogul, Tukay, Akmulla, Natsagdorj, Rudaki (PD) · Ornament: code
// Fonts: Alegreya, Alegreya Sans, Piazzolla (SIL OFL 1.1) · Needs postext ≥ 1.100.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the colophon ('en' | 'es' | 'ru')
const RECIPE = 'abai-kazakh-anthology';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// The dyed felts of a shyrdak, the mosaic rug of the yurt: madder, indigo, pine and bark, all
// cut against undyed wool.
const palette = {
ink: '#2a1d17', // text, brown-black wool
red: '#9c2a26', // madder: Abai, Rudaki, the note marks
blue: '#1f4e79', // indigo: Toktogul, Natsagdorj
green: '#2f5d3a', // pine: Tukay
ochre: '#8a5010', // bark: Akmulla
gold: '#dba544', // the small triangles and diamonds
cream: '#f5ecda', // the paper and the undyed wool
muted: '#6b5647', // languages, dates, notes
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.red })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// All three hold ә ғ қ ң ө ұ ү һ, ҙ ҫ ҡ and ҷ ҳ ӣ ӯ in their cyrillic-ext files.
const [TEXT, SANS, DISPLAY] = ['Alegreya', 'Alegreya Sans', 'Piazzolla'];
const [BODY, LEAD] = [11, 14.5]; // pt
const [TRIM_W, TRIM_H, TOP, INNER, OUTER] = [145, 215, 22, 21, 19]; // mm: 60 × 90/16
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, fontFamily, size, fontWeight, color, placement, extra = {}) => ({
kind: 'text', id, content, fontFamily, fontSize: pt(size), fontWeight, color: col(color),
align: 'left', lineHeight: 1.1, overflow: 'wrap', placement, ...extra });
const fill = { size: { width: 'fill' } };
const image = (id, resourceId, placement) => ({ kind: 'image', id, resourceId, placement });
// #region answer: a Kazakh document, with each poem named in its own language
// The book is Kazakh: its hyphenation, the ties (a dash opens no line, a number keeps its unit)
// and its notes, which start again on every page with an indent of 1.5 em.
const LOCALE = 'kk';
// A poem in another language is a :::verse block that names it: the poem is shaped by that
// language and tagged with it in the PDF and the HTML, :::verse{lang=ky}.
// ky Kyrgyz, tt Tatar, ba Bashkir, mn Mongolian, tg Tajik. Two spaces at the head of a line
// draw it in, as in the third and sixth lines of «Сегіз аяқ».
const verse = { align: 'center', hang: em(2), keepStanzas: 8 }; // bodyText.verse
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
أخطاء شائعة
- افحص الخط حرفًا حرفًا قبل اختياره. يحوي Alegreya وPiazzolla الحروف ә ғ қ ң ө ұ ү һ ҙ ҫ ҡ ҳ ҷ ӣ ӯ، وينقص بعضها في Literata وSpectral وOld Standard. وهي في ملفات
cyrillic-extالتي يحمّلهاkitCyrillicFonts. - العنوان الذي لا
toneله لا يسمّي رسمًا، فيبقى لوحه فارغًا. أعط كل قصيدة واحدًا من الألوان الأربعة.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- «Бірінші сөз» (1890) · Abai Qunanbaiuly · ملك عام
- «Сегіз аяқ», first stanza · Abai Qunanbaiuly · ملك عام
- «Үлгү ырлар», four stanzas of seven · Toktogul Satylganov · ملك عام
- «Туган тел» (1909) · Ğabdulla Tukay · ملك عام
- «Башҡорттарым, уҡыу кәрәк!», four stanzas · Miftahetdin Akmulla · ملك عام
- «Миний нутаг», first three stanzas, spelling after several modern editions · Dashdorjiin Natsagdorj · ملك عام
- «Бӯи ҷӯи Мӯлиён» in Tajik Cyrillic · Rudaki · ملك عام
- The title, the glosses and the colophon · Postext Cookbook · أصلي
- الخطوط
- Alegreya (SIL OFL 1.1) · Alegreya Sans (SIL OFL 1.1) · Piazzolla (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


