Перейти к основному содержанию
Рецепт номер 70

Рецепты · Глава 9 · Полные издания

Пьеса: действующие лица, реплики и ремарки

Пьеса Уайльда для актёров: имена полужирным сливовым, ремарки серым курсивом, а в списке лиц отточие ведёт к каждому актёру на позиции табуляции.

с. 2–3 из 5

  • Образец на английском: русского издания пока нет
  • Обрезной формат 140 × 216 мм
  • 1 колонка
  • Libre Baskerville 9,4/13,6
  • Abril Fatface
  • Playfair Display SC
  • 5 страниц
  • Уровень
  • Postext 1.57.1
  • Свёрстано за 85 мс
  • Строк кода: 160

Коротко

Начало знаменитой комедии Оскара Уайльда, напечатанное для актёров. Имена говорящих выделены цветом, а ремарки набраны серым, чтобы их легко было пропускать.

Что получится

Начало пьесы Оскара Уайльда The Importance of Being Earnest («Как важно быть серьёзным») — пятистраничное актёрское издание формата 140 × 216 мм. Титульный лист сделан как сливовая афиша в двойной золотой рамке: Importance и Earnest жирными прописными, под названием золотая гвоздика. Напротив первого акта список действующих лиц называет актёров, сыгравших роли в театре Сент-Джеймс в 1895 году. Каждая реплика открывается именем говорящего полужирным сливовым, а её продолжающие строки сдвинуты на 5 мм, и актёр находит следующую реплику с одного взгляда. Ремарки, внутри реплики и между репликами, набраны серым курсивом: на прогоне глаз их пропускает. Испанское издание — новый перевод по испанской театральной традиции, с тире после имени и ремарками в скобках.

Рецепт отвечает на вопросы

  • Как набрать сценарий или пьесу: заголовки сцен, имена персонажей, реплики с отступом с обеих сторон?
  • Как выделить цветом ключевые термины (полужирным или курсивом) в тексте или во врезках?
  • Как поставить рисунки без номера: орнаменты, виньетки, логотипы?

Короткий ответ

script.js · строки 34–54в полном коде
// Speeches are plain paragraphs, the speaker's name in bold and each stage direction in
// italic; a direction between two speeches is a paragraph of its own, in a container:
//   **LANE.** Yes, sir. *[Hands them on a salver.]*
//   :::paragraphs{style="direction"}
//   *[Enter Lane.]*
//   :::
// The body's two emphasis colours then mark who speaks (plum) and what is done (grey).
const dialogue = {
  fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
  boldColor: col('plum'), // **ALGERNON.**
  italicColor: col('muted'), // *[Languidly.]*, in a speech or a paragraph of its own
  minWordSpacing: 0.65, maxWordSpacing: 1.8, // justified (the default); limits inside 0.6–2
  // A runt fix tracks by 5/1000 em at most (default 10). At 10, “that?” went up beside “as”
  // and the speech stood darker than the ones around it; at 5 the word turns over.
  maxRuntTracking: 5,
  firstLineIndent: mm(5), hangingIndent: true, // the name at the margin, the turnovers hung
};
// Directions: smaller and centred, on the same grid. They are written *…* like the ones
// inside a speech, so both take the body's italic grey.
const direction = { id: 'direction', fontSize: pt(8.6),
  textAlign: 'center', firstLineIndent: pt(0) };

Ингредиенты

Возможности
Стили абзацевПолужирный, курсив и их цветаПозиции табуляции и отточиеОтступы, выключка и отбивка абзацевУровни заголовковГлавы с правой полосыСобственные типы ресурсовРисунки точно здесьСтили заголовковОбложки, титулы и колофоныАтрибуты заголовковИллюстрации в дизайне страницыТекст, линейки и рамки в дизайне страницыКолонтитулы и колонцифрыКолонтитулы по роли страницыМетаданные документаЦвет бумагиСемантическая палитра
Шрифты
Libre Baskerville, Abril Fatface, Playfair Display SC (SIL OFL 1.1)
Материалы
  • The title page’s frame and the carnation fleuron, drawn in code in the page’s palette (Ignacio Ferro, MIT)

Порядок работы

#1 · Акт — обычный заголовок

script.js · строки 58–69в полном коде
const headings = {
  fontFamily: LABEL, fontWeight: 400, color: col('ink'),
  textAlign: 'center', // every level: the act, the cast list's heads, the scene
  lineHeight: pt(LEAD), marginTop: pt(LEAD), marginBottom: pt(0), // whole lines of the grid
  levels: [
    { level: 1, fontFamily: DISPLAY, fontSize: pt(24), lineHeight: pt(3 * LEAD),
      color: col('plum'), textTransform: 'uppercase',
      breakBefore: { enabled: true, parity: 'odd' } }, // a recto, facing the cast list
    { level: 2, fontSize: pt(13), lineHeight: pt(2 * LEAD) },
    { level: 3, fontSize: pt(9.5), color: col('plum') },
  ],
};

Заголовок акта — это заголовок первого уровня гарнитурой Abril Fatface 24 пт без слота оформления. textTransform переводит его в прописные, а три строки сетки по 13,6 пт ставят прописные на 5,5 мм ниже верха полосы набора (заголовки). textAlign: 'center' нельзя задать для отдельного уровня, поэтому по центру стоят и заголовки списка лиц, и помета Scene. breakBefore с чётностью 'odd' начинает акт с правой полосы, напротив списка лиц. Значение по умолчанию, 'always-odd', вставило бы между ними две пустые страницы (разрыв перед заголовком).

#2 · Список лиц: отточие до имени актёра

script.js · строки 73–85в полном коде
// A tab sends the actor to a stop at the end of the measure that ends the text there; the stop's
// leader fills the room before it with dots, from half an em after the person to half an em
// before the actor. The bill's head is a centred line in the face's own small capitals.
const person = { id: 'person', fontSize: pt(8.8), firstLineIndent: pt(0), textAlign: 'left',
  tabStops: [{ position: 'end', align: 'end', leader: '.' }],
  spaceBetween: pt(LEAD / 2) }; // a person every line and a half
const billHead = { id: 'bill-head', fontFamily: LABEL, fontSize: pt(8.5), color: col('plum'),
  textAlign: 'center', firstLineIndent: pt(0), marginTop: pt(LEAD / 2),
  marginBottom: pt(LEAD / 2) };
// The scenes: two stops, so `:tab Act I :tab Algernon’s flat` ends the act on the first
// (15 mm in) and starts the place on the second, 2 mm after it, as a two-column list would.
const scene = { id: 'scene', textAlign: 'left', firstLineIndent: pt(0), marginTop: pt(LEAD / 2),
  tabStops: [{ position: mm(15), align: 'end' }, { position: mm(17) }] };

Каждое лицо — абзац стиля person, актёр стоит после :tab (табуляция и позиции табуляции). У стиля одна позиция табуляции, 'end', то есть конец строки, и с align: 'end' имя актёра кончается там. Её leader: '.' заполняет место перед позицией точками, отступая на половину em от лица и от актёра, а spaceBetween ставит лица через полторы строки. Имена лиц полужирные, поэтому печатаются сливовым, как имена говорящих в диалоге. Первый состав, театр и дата открывают список в стиле bill-head, по центру, гарнитурой Playfair Display SC, у которой строчные буквы — капитель. Места действия используют две позиции: :tab Act I :tab … заканчивает Act I на первой, в 15 мм, с align: 'end', так что три акта выключены вправо по одной вертикали, а место начинается на второй, ещё через 2 мм. Время действия — центрированная строка в стиле ремарок.

#3 · Украшения без номера и подписи

script.js · строки 89–94в полном коде
// ::resource{id="fleuron"} sets it where it stands (gotcha: resource-double-quotes).
const unnumbered = (id, name, defaultPlacement) => ({ id, name, shortLabel: '', captionPrefix: '',
  numberingTemplate: '{n}', resetOn: 'never', counterFormat: 'decimal', defaultPlacement });
const resourceTypes = [
  unnumbered('ornament', 'Ornament', { position: 'here', width: 0.24, align: 'center' }),
];

Тип ресурса с пустыми captionPrefix и shortLabel печатает свои картинки без подписи (типы ресурсов). Его defaultPlacement ставит гвоздику там, где стоит ::resource{id="fleuron"}, по центру и шириной 0,24 от строки в 107 мм, около 26 мм.

#4 · Титульный лист — стиль заголовка

script.js · строки 98–120в полном коде
// # The Importance of Being Earnest {style="playbill" small="The" big="Importance" …}
// Each attribute is a playbill line in its own face and size. The ground is an image that
// fills the sheet: the heading reserves down to its foot, so the cast list starts on page 2.
const line = (id, content, font, size, y, color, extra = {}) => ({ kind: 'text', id, content,
  fontFamily: font, fontSize: pt(size), lineHeight: 1, color: col(color), align: 'center',
  placement: { anchor: { to: 'page', edge: 'top' }, offset: { y: mm(y) } }, ...extra });
const tracked = (track) => ({ textTransform: 'uppercase', letterSpacing: pt(track) });
const playbill = {
  id: 'playbill', span: 'page', // kept in the column, its foot would cut the ground
  header: { elements: [] }, footer: { elements: [] }, // no heads on p. 2, no folio on p. 1
  advancedDesign: { enabled: true, slot: { elements: [
    { kind: 'image', id: 'ground', resourceId: 'playbill',
      placement: { anchor: { to: 'bleed', edge: 'top-left' }, size: { width: 'fill' } } },
    line('kicker', '{subtitle}', LABEL, 8.5, 36, 'gilt', tracked(1.7)),
    line('small', '{attr.small}', TEXT, 17, 51, 'paper', { italic: true }),
    line('big', '{attr.big}', DISPLAY, 40, 60, 'paper', { textTransform: 'uppercase' }),
    line('link', '{attr.link}', TEXT, 17, 78, 'gilt', { italic: true }),
    line('name', '{attr.name}', DISPLAY, 60, 87, 'paper', { textTransform: 'uppercase' }),
    line('author', '{author}', LABEL, 13, 133, 'paper', tracked(3)),
    line('theatre', '{attr.theatre}', LABEL, 8, 170, 'gilt', tracked(1.6)),
    line('premiere', '{attr.premiere}', TEXT, 8.5, 176, 'paper', { italic: true }),
  ] } },
};

# The Importance of Being Earnest {style="playbill" …} несёт название в четырёх атрибутах, которые оформление набирает двумя гарнитурами: Abril Fatface 40 и 60 пт для существительных и курсив Libre Baskerville 17 пт для The и of Being (атрибуты заголовка). Сливовый фон, рамка и гвоздика — один SVG, нарисованный кодом и привязанный к вылету (элементы-изображения). Стиль задаёт span: 'page', хотя в книге одна колонка. В колонке оформление было бы обрезано по низу полосы набора, в 23,3 мм от нижнего края листа. Пустой header стиля убирает колонтитулы со списка лиц, который относится к тому же разделу, а пустой footer убирает нижнюю колонцифру с титула, где она печаталась бы сливовым по сливовому (стили заголовков).

Фон — элемент-изображение, а начальная полоса резервирует место до низа своих изображений, поэтому заголовок занимает весь лист: The Persons of the Play начинается на странице 2 без :::pagebreak после титула, где бы ни стояли его строки. Центрированной строке с letterSpacing поправка тоже не нужна. Пробел после последней буквы при центрировании не учитывается, и OSCAR WILDE стоит ровно по центру страницы.

#5 · Колонтитулы, которых нет на первой странице акта

script.js · строки 124–140в полном коде
const head = (id, content, parity, edge, x, style) => ({
  kind: 'text', id, content, parity, pages: 'body', // never on openers or blank pages
  fontFamily: LABEL, fontSize: pt(8.5), letterSpacing: pt(0.8), color: col('muted'),
  textTransform: 'uppercase', ...style,
  placement: { anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(11) } },
});
const folio = { fontFamily: TEXT, letterSpacing: pt(0), color: col('plum') };
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
  head('verso-title', '{title}', 'even', 'top-left', OUTER + 8),
  head('recto-act', '{chapterTitle}', 'odd', 'top-right', -(OUTER + 8)),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };
// The act's first page carries a drop folio instead, centred under the text block.
const footer = { elements: [{ ...head('drop-folio', '{pageNumber}', 'all', 'top', 0, folio),
  pages: 'opener', align: 'center',
  placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(8) } } }] };

На левой полосе стоит название пьесы из метаданных, на правой акт из {chapterTitle}, оба прописными Playfair Display SC, со сливовой колонцифрой у наружного края (текстовые элементы). Первая страница акта считается начальной, потому что её первый блок — заголовок с разрывом страницы, поэтому pages: 'body' не ставит на неё колонтитулы, а нижний колонтитул даёт ей колонцифру внизу.

Рецепт целиком

Sandbox
// ═══ Postext Cookbook · Nº 070 · Play script: cast list, speakers and stage directions ═══
// https://postext.dev/en/cookbook/stage-play
// Code: MIT · Text: Oscar Wilde, 1895 (PD, Gutenberg #844), Spanish: the Cookbook · Art: in code
// Fonts: Libre Baskerville, Abril Fatface, Playfair Display SC (OFL 1.1) · Needs postext ≥ 1.25.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';

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

// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // every colour in the config links to one of these
  ink: '#221b1f', // the dialogue: a near-black with a little plum in it
  plum: '#5b2349', // the one accent: speakers' names, act titles, the title page's ground
  gold: '#b48a45', // rules and ornaments
  gilt: '#c9aa77', // gold lightened for small type on the plum ground (5.3:1)
  muted: '#6c6168', // stage directions and running heads (5.5:1 on the paper)
  paper: '#fbf6ec', // a cream stock
};
// A colour is its hex and the palette entry it follows.
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' } })),
  // The engine's defaults link to 'main-color': point it at the accent, so nothing prints blue.
  { id: 'main-color', name: 'plum (defaults)', value: { hex: palette.plum, model: 'hex' } },
];
const [TEXT, DISPLAY, LABEL] = ['Libre Baskerville', 'Abril Fatface', 'Playfair Display SC'];
const [BODY, LEAD] = [9.4, 13.6]; // pt: the dialogue and its leading, the pitch of the grid
const TRIM = { width: 140, height: 216 }; // mm: 5½ × 8½ in, the acting-edition size
const [TOP, INNER, OUTER, LINES] = [20, 18, 15, 36]; // mm, and 36 lines to a full page

// #region answer: a speech is a paragraph: the name in bold, the directions in italic
// Speeches are plain paragraphs, the speaker's name in bold and each stage direction in
// italic; a direction between two speeches is a paragraph of its own, in a container:
//   **LANE.** Yes, sir. *[Hands them on a salver.]*
//   :::paragraphs{style="direction"}
//   *[Enter Lane.]*
//   :::
// The body's two emphasis colours then mark who speaks (plum) and what is done (grey).
const dialogue = {
  fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
  boldColor: col('plum'), // **ALGERNON.**
  italicColor: col('muted'), // *[Languidly.]*, in a speech or a paragraph of its own
  minWordSpacing: 0.65, maxWordSpacing: 1.8, // justified (the default); limits inside 0.6–2
  // A runt fix tracks by 5/1000 em at most (default 10). At 10, “that?” went up beside “as”
  // and the speech stood darker than the ones around it; at 5 the word turns over.
  maxRuntTracking: 5,

Собранный script.js работает как есть: вставьте его в модульный скрипт любой страницы или откройте рецепт на CodePen. Папка рецепта на GitHub ↗ (открывается в новой вкладке)

Варианты

#Выровняйте ремарки по продолжающим строкам

При выключке влево с абзацным отступом 5 мм однострочная ремарка начинается там же, где продолжающие строки реплик, а описание сцены превращается в два абзаца с отступом под центрированной пометой.

 const direction = { id: 'direction', fontSize: pt(8.6),
-  textAlign: 'center', firstLineIndent: pt(0) };
+  textAlign: 'left', firstLineIndent: mm(5) };

#Оставьте строку между репликами

paragraphSpacing: true добавляет пустую строку сетки после каждой реплики. Английский акт тогда занимает пять страниц вместо трёх, испанский четыре.

   firstLineIndent: mm(5), hangingIndent: true, // the name at the margin, the turnovers hung
+  paragraphSpacing: true,
 };

Частые ошибки

Подводный камень

::resource{id="…"} — только с двойными кавычками

Вставка блоком распознаётся только в виде ::resource{id="…"} с двойными кавычками; любая другая форма остаётся в тексте видимой строкой. Рисунки точно здесь →

  • Любой курсив в диалоге берёт italicColor, смысловое выделение тоже, поэтому подчёркнутое Лейном is печатается серым цветом ремарок. Серый задан в bodyText, потому что большинство ремарок стоит внутри реплики, в одном абзаце с выделением; чёрным is остался бы только в прямом начертании.
  • Три реплики Уайльда кончаются одним словом на строке: information., you. и that? Исправление коротких концевых строк может поднять третье слово на строку выше, но только с 1 % отрицательного трекинга, который по умолчанию допускает bodyText.maxRuntTracking, и тогда реплика темнее соседних. maxRuntTracking: 5 вдвое уменьшает этот предел: that? переходит на новую строку, а строка над ним раскрывается до 1,78 нормального межсловного пробела, в пределах 1,8. Английские страницы оставляют три короткие строки, чтобы не менять слова Уайльда. В испанском переводе фразы изменены везде, где строка кончалась однобуквенным словом или слог оставался один.
  • Имена переносятся, как любые слова: Au-gusta и Gwen-dolen разорваны на странице 5. Соединитель слов (U+2060) внутри Augusta сохраняет имя целым, но растягивает строку выше до 1,71 нормального межсловного пробела, поэтому в английском тексте переносы оставлены.
  • Playfair Display SC рисует fi на холсте строчной лигатурой, и в first среди капители оказалось бы строчное fi. Поэтому список лиц начинается словами The original cast.

Источники и лицензии

Рецепт
Ignacio Ferro
Текст
  • The Importance of Being Earnest (1895): the persons and scenes of the play, the first cast and the opening of the first act · Oscar Wilde · общественное достояние
  • The Spanish translation of the extract, the cast list and the scenes · Postext Cookbook · оригинал
Изображения
  • The title page’s frame and the carnation fleuron, drawn in code in the page’s palette · Ignacio Ferro · MIT
Шрифты
Libre Baskerville (SIL OFL 1.1) · Abril Fatface (SIL OFL 1.1) · Playfair Display SC (SIL OFL 1.1)
Sandbox