简单来说
奥斯卡·王尔德一部名剧的开头,排成演员用的剧本。说话人的名字用彩色粗体,舞台说明用灰色,方便演员跳过。
成品一览
把王尔德《The Importance of Being Earnest》的开头排成一本五页的演出本,页面为140 × 216 mm。书名页是一张梅紫色戏单,外有双重金色边框,Importance和Earnest用粗肥体(fat face)大写字母,标题下有一朵金色康乃馨。与第一幕相对的角色表列出1895年在St James’s Theatre首演各角色的演员。每段台词以梅紫色粗体的说话人姓名开头,转行悬挂缩进5 mm,演员一眼就能找到下一句提示。舞台提示无论在台词中间还是两段台词之间,都用灰色斜体,对词时眼睛可以跳过它们。西班牙语版本是一个新译本,遵循西班牙语舞台惯例:每个人名后加破折号,舞台提示放在括号中。
这道食谱解答
- 怎样排电影剧本或戏剧剧本:场景标题、角色名、两侧缩进的对白?
- 怎样给正文或框里的关键词(粗体或斜体)着色?
- 怎样排不编号的插图:饰图、小花饰、标志?
简短回答
// 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) };
用料
做法
#1 · 一幕就是一个普通标题
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') },
],
};
幕标题是一个一级标题,用24 pt的Abril Fatface,没有版面设计槽位。textTransform把它排成大写,13.6 pt的三条网格线让大写字母位于版心顶部以下5.5 mm处(标题)。textAlign: 'center'不能按级别设置,所以角色表的标题和Scene标签也会居中。parity为'odd'的breakBefore让这一幕从右页开始,与角色表相对。默认值'always-odd'会在两者之间留下两个空白页(分页前置)。
#2 · 角色表用一行点引到每位演员
// 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 mm,align: 'end'),所以三幕在一栏中右对齐;地点从第二个制表位开始,再往后2 mm。剧情时间是一行居中的文字,用舞台提示的样式。
#3 · 不带编号和题注的装饰图
// ::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"}所在的位置,居中,宽为107 mm行长的0.24,约26 mm。
#4 · 书名页是一个标题样式
// # 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" …}把标题分放在四个属性中,版面设计用两种字体排出:名词用40 pt和60 pt的Abril Fatface,The和of Being用17 pt的Libre Baskerville斜体(标题属性)。梅紫色底、边框和康乃馨是一张用代码画出的SVG,锚定在出血边上(图片元素)。这本书只有一栏,但样式仍设了span: 'page'。如果留在栏内,版面设计会在版心底部被裁掉,即纸张底边以上23.3 mm处。样式中空的header让书眉不出现在属于同一节的角色表上,空的footer让页脚页码不出现在书名页上,否则它会以梅紫色印在梅紫色底上(标题样式)。
底图是一个图片元素,而首页标题会把高度预留到图片底边,所以这个标题占满整张纸:无论书名页上各行放在哪里,标题后面不写:::pagebreak,The Persons of the Play也从第2页开始。设了letterSpacing的居中行也不用修正:居中时不计最后一个字母后面的字距,OSCAR WILDE正好落在页面中线上。
#5 · 跳过每幕首页的书眉
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'让书眉不出现在这一页,页脚则为它印一个页脚页码。
完整食谱
// ═══ 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 mm首行缩进后,单行的舞台提示从台词转行开始的位置排起,场景说明则变成居中标签下两个缩进的段落。
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,
};常见问题
- 对白中的每一段斜体都使用
italicColor,包括强调,所以Lane那个强调的is会印成舞台提示的灰色。灰色设在bodyText上,因为大多数舞台提示写在台词里面,和强调在同一个段落;只有用正体,is才能保持墨色。 - 王尔德有三段台词以单独一个词结尾:information.、you.和that?。第三处可以由孤字修正拉回上一行,但要用到
bodyText.maxRuntTracking默认允许的1%负字距,这段台词就比上下几段显得更黑。maxRuntTracking: 5把这个上限减半:*that?*转到下一行,上面一行的词间距放宽到正常的1.78倍,仍在1.8的限度之内。英文页面宁可保留这三个孤字,也不改王尔德的原文。西班牙语译文则在凡是一行以单字母词结尾或一个音节单独成行的地方都改了措辞。 - 人名和其他词一样会断词:第5页上Au-gusta和Gwen-dolen跨行断开。在Augusta中间加一个词连接符(U+2060)能让它保持完整,但会把上一行的词间距拉到正常的1.71倍,所以英文文本保留了连字符。
- Playfair Display SC在Canvas上把fi画成小写连字,所以first会在小型大写字母中间印出一个小写的fi。这就是角色表开头一行写The original cast的原因。
致谢
- 文本
- 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)


