باختصار
كتاب صور أفقي يروي يومًا في الجبال بست صور. يبيّن كيف تملأ صفحات كاملة بالصور حتى الحافة، وكيف تمدّ صورة واحدة على صفحتين متقابلتين.
ما الذي ستنضده
Sierra، كتاب صور أفقي على صفحة مقاسها 280 × 210 mm: يوم واحد في سلسلة من الغرانيت في ست لوحات، من أول الضوء إلى الصباح الذي يلي أول ثلج. تملأ كل لوحة صفحتها حتى حدّ القص، وليس عليها إلا رقم صغير والساعة في زاويتها السفلى اليسرى؛ وعلى الأولى أيضًا العنوان، SIERRA بخط Syne بحجم 72 pt، معكوسًا بالأبيض على سماء الفجر. تعبر العاصفة الفاصل الداخلي بين الصفحتين 4 و5 صورةً واحدة. ثلاثة نصوص قصيرة، منضَّدة في عمود عرضه 100 mm قرب الكعب، تقابل اللوحات التي تليها. وينتهي نص العاصفة بلوحة غسق أصغر تطفو تحته، رقمها في تعليقها. تُظهر اللوحة الأخيرة حلبة اللوحة الثانية من الصخرة نفسها، تحت الثلج. اللوحات صور فوتوغرافية مولَّدة بنماذج الانتشار؛ وصُنعت لوحة الثلج بتعديل لوحة الظهيرة، فيتطابق المنظران.
تجيب هذه الوصفة عن
- كيف أعطي كل فصل صورته أو لونه أو شكل افتتاحه الخاص؟
- كيف أُدرج صفحات فارغة مقصودة، أو أبدأ قسمًا على صفحتين متقابلتين جديدتين؟
- كيف أخفي الترويسات في صفحات الافتتاح والصفحات الفارغة، أو ألوّن صفحة زوجية فارغة بلون الجزء؟
- كيف أنضد رسومًا غير مرقّمة: زخارف، وحليات، وشعارات؟
الجواب المختصر
// '{attr.art}' is filled in per heading, so a plain plate names its picture on its line:
// # Noon {style="lamina" art="mediodia" …}. Only the cover and the last plate draw extras.
const PLATES = [ // the style id, its picture, the ink of its caption, anything extra it draws
{ id: 'alba', art: 'alba', extra: (colour) => cover(colour) }, // an arrow: cover() is below
{ id: 'lamina', art: '{attr.art}' }, // any plate on a page of its own
{ id: 'pliego', art: '{attr.art}', half: 'verso' }, // one picture across a spread:
{ id: 'pliego-recto', art: '{attr.art}', half: 'recto' }, // the left half, then the right
{ id: 'nieve', art: 'nieve', ink: 'ink', extra: (colour) => colophon(colour) },
];
const plate = ({ id, art, half, ink = 'white', extra = () => [] }) => ({
id, span: 'page', // an opener: a span heading always starts a page of its own
// The left half opens on an even page, a verso, so the right half faces it across the
// gutter (gotcha: parity-page1-recto).
...(half === 'verso' && { breakBefore: { enabled: true, parity: 'even' } }),
// The picture is as deep as the page, more than the column holds: the plate claims the
// whole page, and what follows starts on the next one.
advancedDesign: { enabled: true, slot: { elements: [
{ kind: 'image', id: 'picture', resourceId: art, // the recto half is the same picture,
placement: at('page', 'top-left', half === 'recto' ? -PAGE.width : 0, 0, // moved left
{ width: mm(half ? 2 * PAGE.width : PAGE.width), height: mm(PAGE.height) }) },
...(half === 'recto' ? [] : caption(col(ink))), ...extra(col(ink)),
] } },
});
المكونات
- الميزات
- الصور في تصاميم الصفحةأنماط العناوينصفحات افتتاح مصمَّمةتثبيت عناصر التصميمهندسة القسمسمات العنوانفصول تبدأ في صفحة فرديةالترويسات بحسب دور الصفحةاستشهادات تضع الأشكالأنواع موارد مخصّصةنمط التعليقالأغلفة وصفحات العنوان وبيانات النشرلون الورقهوامش متناظرةالنصوص والخطوط والمربعات في تصاميم الصفحةتقسيم الكلمات ولغة المستندلوحة ألوان دلاليةالأشكال والجداول بوصفها مواردصفحات على اللوحة (Canvas)
- الخطوط
- Andada Pro, Syne, Syne Mono (SIL OFL 1.1)
- الأصول
alba-1600.jpgatardecer-2000.jpgmediodia-1600.jpgnieve-1600.jpgnoche-1600.jpgtormenta-2400.jpg- Plate I, dawn: ridges fading into a peach haze under a dark blue sky (Generated With Diffusion Models, أصلي)
- Plate II, noon: a granite cirque and its lake (Generated With Diffusion Models, أصلي)
- Plate III, storm: rain, lightning and a break of sun across a spread (Generated With Diffusion Models, أصلي)
- Plate IV, dusk: the crest lit orange under a violet sky (Generated With Diffusion Models, أصلي)
- Plate V, night: stars over the ridges and a lit refuge (Generated With Diffusion Models, أصلي)
- Plate VI, snow: the cirque of plate II the morning after (Generated With Diffusion Models, أصلي)
طريقة التحضير
#1 · نمط عنوان لكل لوحة، مبني من قائمة
الشيفرة هي الجواب المختصر أعلاه. تبني plate() نمط عنوان من كل صف في PLATES، ويحدد Markdown ترتيب المقالة، سطرًا لكل لوحة: # Night {style="lamina" art="noche" n="V" hora="22:10"}. قيمة resourceId في عنصر الصورة هي '{attr.art}'، وهي عنصر نائب مثل عناصر النص، فتتشارك كل اللوحات البسيطة النمط lamina وتحدّد كل منها صورتها في سطر عنوانها؛ ولا يحتفظ بنمط خاص إلا الغلاف واللوحة الأخيرة، لأنهما يرسمان عناصر إضافية (عناصر الصور). يبدأ span: 'page' كل لوحة في صفحة خاصة بها. ارتفاع الصورة 210 mm، أي ارتفاع الصفحة، والتصميم يحجز حتى أسفل صوره. وهذا أكثر من عمود صفحات النص البالغ 158 mm، فتأخذ اللوحة الصفحة كلها ويبدأ ما يليها في الصفحة التالية، بلا minHeight ولا هوامش خاصة بها.
يرسم نمطا الصفحتين المتقابلتين، pliego وpliego-recto، الصورة نفسها بعرض 560 mm، وهي هنا art="tormenta": نصف الصفحة الزوجية عند الحافة اليسرى للصفحة، ونصف الصفحة الفردية مزاحًا 280 mm نحو اليسار، فتُظهر كل صفحة نصفها ويقصّ Canvas الباقي عند حدّ القص. يُبقي parity: 'even' النصفين متقابلين. من دونه، لو أُخرجت لوحة الظهيرة من Markdown لوقع النصف الأيسر في الصفحة 3، وهي صفحة فردية، والنصف الأيمن على ظهرها في الصفحة 4؛ ومعه تبقى الصفحة 3 فارغة وتملأ العاصفة الصفحتين 4 و5 كما هي.
#2 · الرقم والساعة يأتيان من سطر العنوان
const NUMERAL = { x: 16, y: PAGE.height - 21, size: 13 }; // mm from the top left; size in pt
// A design text's baseline sits 0.8 of its line box below its top: set a smaller label beside
// a larger one this much lower and the two share a baseline.
const dropTo = (big, small, lineHeight = 1.2) => (0.8 * lineHeight * (big - small) * 25.4) / 72;
const caption = (colour) => [
{ kind: 'text', id: 'numeral', content: '{attr.n}', fontFamily: 'Syne', fontWeight: 700,
fontSize: pt(NUMERAL.size), color: colour, align: 'left',
placement: at('page', 'top-left', NUMERAL.x, NUMERAL.y) },
{ kind: 'text', id: 'hour', content: '· {attr.hora}', fontFamily: 'Syne Mono', fontSize: pt(8),
letterSpacing: pt(0.8), color: colour, align: 'left', // the dot: a lone I reads as a bar
placement: at('#numeral', 'right-of', 1.6, dropTo(NUMERAL.size, 8)) },
];
الرقم والساعة سمتان للعنوان، فيبقى المحتوى في Markdown ويخدم تصميم واحد كل اللوحات. تُربط الساعة right-of الرقم، فتتحاذى قمّتاهما. يقع خط الأساس لنص التصميم على بُعد 0.8 من مستطيل سطره تحت أعلى العنصر، ومستطيل السطر 1.2 مرة من حجم الحرف افتراضيًا، لذلك تُنزل dropTo(13, 8) الساعة بمقدار 0.8 × 1.2 × (13 − 8) pt وتضع الساعة بحجم 8 pt على خط أساس الرقم بحجم 13 pt، على بُعد 193.4 mm من أعلى الصفحة. تبدأ الساعة بنقطة وسطى، كما يفعل تعليق اللوحة IV، لأن حرف I في Syne عمود بسيط، ووحده بجانب الساعة يُقرأ خطًا. لا يرسم نصف العاصفة في الصفحة الفردية تعليقًا، وتنضّد لوحة الثلج تعليقها بلون الحبر، لأن مقدمتها بيضاء.
#3 · عنوان وبيانات طبع على اللوحات نفسها
const cover = (colour) => [
{ kind: 'text', id: 'title', content: '{title}', fontFamily: 'Syne', fontWeight: 800,
fontSize: pt(72), lineHeight: 1, letterSpacing: pt(6), textTransform: 'uppercase',
color: colour, align: 'left', placement: at('page', 'top-left', 22, 26) },
{ kind: 'text', id: 'subtitle', content: '{subtitle}', fontFamily: 'Syne Mono',
fontSize: pt(10), letterSpacing: pt(2), textTransform: 'uppercase', color: colour,
align: 'left', placement: at('#title', 'below', 1.5, 3) },
];
// The colophon: one element per line, 10.5 pt apart, so the break falls after the licence, and
// the second line on the baseline of the plate's numeral.
const COLOPHON = { y: NUMERAL.y + dropTo(NUMERAL.size, 7.5), leading: (10.5 * 25.4) / 72 };
const colophon = (colour) => ['colofon', 'tipos'].map((key, line) => ({ kind: 'text', id: key,
content: `{attr.${key}}`, fontFamily: 'Syne Mono', fontSize: pt(7.5), letterSpacing: pt(0.2),
color: colour, align: 'right',
placement: at('page', 'top-right', -16, COLOPHON.y - (1 - line) * COLOPHON.leading) }));
اللوحة الأولى هي الغلاف. يقرأ {title} و{subtitle} البيانات التمهيدية (frontmatter)، ويضيف extra في PLATES العنصرين إلى تصميم تلك اللوحة، بلون تعليقها. وتوضع بيانات الطبع على اللوحة الأخيرة بالطريقة نفسها، بلون الحبر على الثلج: عنصران بحجم 7.5 pt، واحد لكل سطر، من السمتين colofon وtipos، محاذيان إلى اليمين، والثاني على خط أساس الرقم. العنصر الواحد الملتف كان سينكسر حيثما نفد عرضه؛ أما بعنصر لكل سطر فيقع الكسر بعد الترخيص.
#4 · النصوص تلي لوحاتها بلا فاصل
const textOpener = { enabled: true, slot: { elements: [
{ kind: 'text', id: 'hours', content: '{attr.hora}', fontFamily: 'Syne Mono', fontSize: pt(8),
letterSpacing: pt(0.8), color: col('accent'), align: 'left',
placement: at('container', 'top-left', 0, 0) },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Syne', fontWeight: 700,
fontSize: pt(28), lineHeight: 1.05, // a multiple of the size
color: col('ink'), align: 'left', overflow: 'wrap',
placement: at('#hours', 'below', 0, 2.5, { width: 'fill' }) },
] } };
// The folio and the book's title under the text block, flush with its left edge, on the
// baseline of the plates' numerals. Not on the plates: a span heading opens their pages, so
// they are opener pages, and 'body' leaves them out.
const foot = (id, content, extra) => ({ kind: 'text', id, content, pages: 'body',
fontFamily: 'Syne Mono', fontSize: pt(7.5), letterSpacing: pt(0.8), color: col('muted'),
align: 'left', ...extra });
const FOOT = NUMERAL.y + dropTo(NUMERAL.size, 7.5) - (PAGE.height - MARGIN.bottom); // from the foot
const footer = { elements: [
foot('folio', '{pageNumber}', { color: col('ink'),
placement: at('container', 'top-left', 0, FOOT) }),
foot('book', '{title}', { textTransform: 'uppercase', placement: at('#folio', 'right-of', 5) }),
] };
اللوحة التي تسبق النص تملأ صفحتها، فيبدأ النص الصفحة التالية من غير فاصل خاص به. الصفحة التي تكون أول كتلة فيها عنوانًا بفاصل هي صفحة افتتاح، ويستبعدها pages: 'body' في رقم الصفحة. ومن دون فاصل تحتفظ صفحات النص برقم صفحتها؛ أما اللوحات، التي تفتتحها عناوين ممتدة، فلا تأخذ رقمًا. ويُلغي breakBefore: { enabled: false } الفاصل إلى صفحة فردية الذي يكون لعنوان المستوى الأول افتراضيًّا؛ ومع ذلك الفاصل تصير صفحة كل نص صفحة افتتاح بلا رقم صفحة. يضع FOOT رقم الصفحة على خط أساس أرقام اللوحات، على بُعد 193.4 mm من أعلى الصفحة، فيقع رقم صفحة النص ورقم اللوحة المقابلة له على سطر واحد.
#5 · صرّح بكل لوحة، واستشهد فقط بالتي تطفو
// Plate IV is the one plate that floats, so a counter of its type would number it 1. The type
// prints no number (no caption prefix, an empty template) and the caption carries the numeral.
// The text names the plate with :ref's text, since a bare :ref prints 'lámina' and nothing else.
const lamina = { id: 'lamina', name: t({ en: 'Plate', es: 'Lámina' }),
shortLabel: t({ en: 'plate', es: 'lámina' }), numberingTemplate: '',
resetOn: 'never', counterFormat: 'decimal', captionPrefix: '' };
// JPEGs in assets/, cut to the page's shape: 1600 × 1200 px for 280 × 210 mm (145 dpi).
const picture = (id, [w, h], alt, extra = {}) => ({ id, typeId: 'lamina', kind: 'bitmap',
bitmap: { fileId: `${id}-${w}.jpg`, format: 'jpeg', width: w, height: h },
createdAt: 0, updatedAt: 0, altText: t(alt), ...extra });
const resources = [ // the five the heading styles draw, never cited, and plate IV
picture('alba', [1600, 1200], { en: 'Eight ridges fading into a peach dawn haze.',
es: 'Ocho crestas que se pierden en la bruma del alba.' }),
picture('mediodia', [1600, 1200], { en: 'A granite cirque and its lake under a pale noon sky.',
es: 'Un circo de granito y su laguna bajo el cielo pálido del mediodía.' }),
picture('tormenta', [2400, 900], { en: 'A storm over the range: rain on the left, lightning '
+ 'and a break of sun on the right.', es: 'Una tormenta sobre la sierra: lluvia a la '
+ 'izquierda; un rayo y un claro de sol a la derecha.' }),
picture('noche', [1600, 1200], { en: 'Stars over dark ridges and two lit windows at a refuge.',
es: 'Estrellas sobre crestas oscuras y dos ventanas encendidas en un refugio.' }),
picture('nieve', [1600, 1200], { en: 'The cirque the morning after, white with new snow.',
es: 'El circo a la mañana siguiente, blanco de nieve nueva.' }),
// 2000 px, 339 mm at the layout's 150 dpi, which the float fits to the 100 mm measure.
picture('atardecer', [2000, 800], { en: 'A crest lit orange under strips of cloud, violet sky.',
es: 'Una cresta encendida de naranja bajo franjas de nube, en un cielo violeta.' },
{ caption: t({ en: 'IV · Dusk · 19:41', es: 'IV · Atardecer · 19:41' }) }),
];
عنصر الصورة في التصميم يرسم موردًا مصرَّحًا به، لذلك توجد الصور الست كلها في resources: ملفات JPEG في مجلد assets/ الخاص بالوصفة، كل منها مقصوص على شكل الصفحة أو الصفحتين المتقابلتين اللتين يملؤهما ومصرَّح به بحجمه بالبكسل، وهو كل ما يقرؤه الإخراج. تسجّل loadImage() كل ملف قبل البناء. اللوحة IV هي الوحيدة المستشهد بها عبر :ref، ولذلك هي الوحيدة التي تطفو. تأخذ أول موضع شاغر بعد الاستشهاد، في صفحة نصها، على بُعد سطر تحت الفقرة الأخيرة. لو كان نوعها مرقَّمًا لجاء تعليقها Plate 1، لأنها المورد الوحيد من نوعها الذي يطفو. بدلًا من ذلك في lamina قيمتان فارغتان هما numberingTemplate وcaptionPrefix، فلا يُطبع Plate.، ويبدأ التعليق نفسه بالرقم IV. وفي الجملة يذكر text في :ref اسم اللوحة، لأن :ref المجرَّد لا يطبع إلا كلمة plate.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 068 · Photo essay with full-bleed plates ═══════════════
// https://postext.dev/en/cookbook/photo-essay-full-bleed
// Code: MIT · Text: original (CC BY 4.0) · Plates: diffusion models
// Fonts: Andada Pro, Syne, Syne Mono (SIL OFL 1.1) · Needs postext ≥ 1.42.1
// Sierra, a landscape photobook: one day in a mountain range in six plates, each on a page of
// its own and one across the gutter of a spread, with three short texts between them.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'es'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'photo-essay-full-bleed';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the paper between the plates, the ink and one rust for the labels
const palette = {
ink: '#1c1f27', // text: the blue-black of the night plate
paper: '#f3f0ea', // every page's ground: a pale stone, seen only between the plates
accent: '#94462e', // the times over each text: the dusk plate's rust, dark enough for 8 pt
muted: '#5f646d', // the running foot and the caption of the small plate
white: '#fbfaf7', // type set on the plates
};
// col() links a colour to its palette entry; the hex is the value the entry holds.
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' } }));
// #endregion
const PAGE = { width: 280, height: 210 }; // a landscape photobook, in mm
const MARGIN = { top: 28, bottom: 24, inner: 40, outer: 140 }; // text pages: a 100 mm measure
const LEAD = 15; // body leading in pt
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
// #region answer: the plates' heading styles, generated from a list
// '{attr.art}' is filled in per heading, so a plain plate names its picture on its line:
// # Noon {style="lamina" art="mediodia" …}. Only the cover and the last plate draw extras.
const PLATES = [ // the style id, its picture, the ink of its caption, anything extra it draws
{ id: 'alba', art: 'alba', extra: (colour) => cover(colour) }, // an arrow: cover() is below
{ id: 'lamina', art: '{attr.art}' }, // any plate on a page of its own
{ id: 'pliego', art: '{attr.art}', half: 'verso' }, // one picture across a spread:
{ id: 'pliego-recto', art: '{attr.art}', half: 'recto' }, // the left half, then the right
{ id: 'nieve', art: 'nieve', ink: 'ink', extra: (colour) => colophon(colour) },
];
const plate = ({ id, art, half, ink = 'white', extra = () => [] }) => ({
id, span: 'page', // an opener: a span heading always starts a page of its own
// The left half opens on an even page, a verso, so the right half faces it across the
// gutter (gotcha: parity-page1-recto).
...(half === 'verso' && { breakBefore: { enabled: true, parity: 'even' } }),
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#اجعل اللوحات تطفو مقابل مداخلها
للّوحات التي تطفو إلى الصفحة الفردية المقابلة لمدخل في فهرس معرض، مع عرض الشكل محسوبًا من نسبه، انظر مداخل فهرس معرض مقابل لوحاتها.
#افتتح مقالة بصورة تنزف حتى الحواف
لصورة تنزف عبر رأس مقالة، وفوقها العنوان والمقدمة، انظر تحقيق المجلة.
أخطاء شائعة
خطأ شائع
الصفحة 1 فردية: خطّط الصفحات بأرقامها الفعلية
الصفحة 1 صفحة يمنى والصفحة 2 أول صفحة زوجية، فخطّط الصفحتين المتقابلتين بأرقام الصفحات الفعلية: الافتتاحية في صفحة زوجية تقابل الصفحة الفردية التي تليها. فواصل الصفحات والأعمدة →
خطأ شائع
لا <marker> ولا مرشِّحات في رسوم SVG (وإلا البديل النقطي)
لا يبقى شكل SVG متّجهيًا في PDF إلا إذا خلا من <marker> والمرشِّحات والأقنعة؛ وإلا عاد إلى صورة نقطية، والمرشِّحات المتداخلة بعمق قد تجعله فارغًا في Chrome. ارسم رؤوس الأسهم مسارات. الأشكال والجداول بوصفها موارد →
- لا تستشهد أبدًا بلوحة يرسمها تصميم. إن استشهدت بها طفت أيضًا شكلًا:
:refإلى لوحة الظهيرة في النص الأول يضع نسخة ثانية منها في الصفحة 3، وتنتقل العاصفة صفحتين إلى الأمام، بعد صفحة فارغة. - تقع لوحة الغسق على بُعد سطر تحت نصها، لا في ذيل الصفحة. في الصفحة الأخيرة من نص، يصعد العنصر العائم الواقع تحت النص إليه (
layout.hugClosingFloats، مفعّل افتراضيًّا)، ولا يغيّرposition: 'bottom'شيئًا هناك. - كل نص مضبوط ليملأ صفحة واحدة في الطبعتين. حين يمتد النص الأول إلى الصفحة 3، تنتقل لوحة الظهيرة إلى الصفحة 4 والعاصفة إلى الصفحتين 6 و7، بعد صفحة 5 فارغة.
- النصف الأيمن من العاصفة عنوان
# Stormثانٍ. لا تطبع الصفحة له عنوانًا، لكن:::tocالمبني من العناوين يسرد العاصفة مرتين، في الصفحتين 4 و5. - تتوقف اللوحات عند حدّ القص، وهو حافة Canvas. مع تفعيل
page.cutLinesيكبر Canvas حول حدّ القص، ويُظهر النزف حول كل لوحة لون الورق. للطباعة، ثبّت اللوحات على'bleed'وكبّر كل واحدة بمقدار النزف من كل جانب.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- The three texts, the captions and the colophon, in Spanish and English, and the six plates, drawn in code · Postext Cookbook · CC BY 4.0
- الصور
- Plate I, dawn: ridges fading into a peach haze under a dark blue sky · Generated With Diffusion Models · أصلي
- Plate II, noon: a granite cirque and its lake · Generated With Diffusion Models · أصلي
- Plate III, storm: rain, lightning and a break of sun across a spread · Generated With Diffusion Models · أصلي
- Plate IV, dusk: the crest lit orange under a violet sky · Generated With Diffusion Models · أصلي
- Plate V, night: stars over the ridges and a lit refuge · Generated With Diffusion Models · أصلي
- Plate VI, snow: the cirque of plate II the morning after · Generated With Diffusion Models · أصلي
- الخطوط
- Andada Pro (SIL OFL 1.1) · Syne (SIL OFL 1.1) · Syne Mono (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


