跳到主要内容
食谱编号61

排版食谱 · 第2章 · 字体与文字

电影剧本格式

一份拍摄剧本,用Courier Prime 12排在US Letter纸上:每段台词是一个无边框的标注框,内边距收到对白栏宽,每场戏在两侧页边距都标有场号。

本页内容
输出
Canvas
难度
中级
Postext
已用Postext 1.65.0测试
需要≥ 1.25.0
许可证
更新于2026年10月11日
代码MIT · 文本CC BY 4.0

页码2–1 · 第2–3页,共5页

  • 英文样例:尚无中文版本
  • 成品尺寸215.9 × 279.4 mm
  • 1栏
  • Courier Prime 12/12
  • Oswald
  • Special Elite
  • 5页
  • 难度
  • Postext 1.57.1
  • 排版用时59 ms
  • 149行代码

简单来说

一部短片的拍摄剧本,按电影公司通行的格式排版。字体像打字机打出来的,对白和场次编号都放在离页边固定的位置。

成品一览

Lost Property的拍摄稿。这是一部虚构的三页短片,按制片厂剧本的方式装订:金黄色卡纸封面,两枚黄铜钉,一张打字标签,封面内侧盖着COPY 07;接着是剧本正文,用Courier Prime以12/12排在打孔的US Letter纸上。各项尺寸取自编剧软件:动作描写从1.5英寸排到7.5英寸,台词从2.5英寸排到6英寸,角色名在3.7英寸处,括号提示从3.1英寸开始,CUT TO:和FADE OUT.齐右页边距结束。每个场景标题在两侧页边距都标有场号。剧本第1页不编页码,其余各页在右上角印页码,后跟句点。每段台词是一个无边框的标注框,角色名排在与正文相同的12 pt行距上,这样动作描写和对白都保持每英寸6行。

这道食谱解答

  • 怎样排电影剧本或戏剧剧本:场景标题、角色名、两侧缩进的对白?

简短回答

script.js · 第43–64行在完整代码中
// Positions from the left edge of the sheet, in inches, as screenwriting software gives them.
const DIALOGUE = { left: 2.5, right: 6 }; // the block of speech, 3.5 inches wide
const CUE = 3.7; // the character's name
const TEXT_RIGHT = 8.5 - MARGIN.right; // 7.5: where action lines end
const dialogue = {
  id: 'dialogue',
  backgroundEnabled: false, // no fill and no border: the box is only a measure
  padding: { top: pt(0), bottom: pt(0),
    left: mm((DIALOGUE.left - MARGIN.left) * IN), // 1 inch in from the action
    right: mm((TEXT_RIGHT - DIALOGUE.right) * IN) }, // 1.5 inches short of it
  // The fence's title is the cue: title="Dora (cont’d)" prints DORA (CONT’D) at 3.7 inches,
  // in the headings' Courier, with no gap under it (the default is half a line). On the
  // body's 12-pt leading (the default is 1.2 times its size, 14.4 pt), the name sits on a
  // grid line and a speech is a whole number of lines.
  titleStyle: { fontWeight: 400, textTransform: 'uppercase', lineHeight: pt(LEAD),
    indent: mm((CUE - DIALOGUE.left) * IN), gap: pt(0) },
  body: { paragraphSpacing: false }, // no blank line before a parenthetical mid-speech
  marginTop: pt(LEAD), marginBottom: pt(LEAD), // one blank line above and below
  // Snapped to the grid, a box keeps its bottom margin and the next speech adds its top
  // margin: two blank lines between speeches. Unsnapped, the two margins collapse into one.
  snapToGrid: false,
};

用料

类型
Courier Prime, Oswald(SIL OFL 1.1) · Special Elite(Apache 2.0)
素材
无:所有图片都用代码绘制

做法

#1 · 给无边框的框加内边距,收到对白栏宽

代码见上文简短回答。标注框的内边距从版心量起,所以左边1英寸、右边1.5英寸,留下的就是距纸边2.5英寸起、宽3.5英寸的对白区域(标注框样式)。角色名是框的标题,在围栏中写作title="Dora (cont’d)"。textTransform把它印成大写,indent把它从内边距再右移1.2英寸,到3.7英寸处。gap设为0,因为默认值会在角色名和台词之间留出半个em,即6 pt。默认情况下,框标题排在一行高为其字号1.2倍的行上,这里是14.4 pt。titleStyle.lineHeight把它改排在正文的12 pt行上,于是角色名落在网格线上,台词是整数个12 pt行;用默认值时,每段台词会把后面的文字再推离网格2.4 pt。关闭snapToGrid后,前一段台词的下外边距和下一段的上外边距合并成一个空行。框默认保持完整,所以放不下的台词会连同角色名一起移到下一页。

#2 · 以英寸设定页面

script.js · 第33–39行在完整代码中
const MARGIN = { top: 1, bottom: 1, left: 1.5, right: 1 }; // inches: the left one takes the brads
const page = { sizePreset: 'custom', width: mm(8.5 * IN), height: mm(11 * IN), dpi: 150,
  margins: { top: mm(MARGIN.top * IN), bottom: mm(MARGIN.bottom * IN),
    left: mm(MARGIN.left * IN), right: mm(MARGIN.right * IN) } };
const bodyText = { fontFamily: TEXT, fontSize: pt(12), lineHeight: pt(LEAD), color: col('ink'),
  textAlign: 'left', firstLineIndent: pt(0), // action: flush left, never justified
  paragraphSpacing: true }; // a blank line between paragraphs

US Letter纸,左页边距1.5英寸,供铜钉穿过,其余三边各1英寸。Courier Prime是等宽字体:12 pt时每个字母宽十分之一英寸,所以一行动作描写容纳60个字符,一行台词容纳35个;行距12 pt时每页容纳54行。正文齐左排、右边不齐,paragraphSpacing在段落之间加一个空行。右边不齐的文字只有在bodyText.hyphenation.ragged要求时才断词,所以剧本中没有一个词被拆开,这正符合格式要求。

#3 · 把括号提示和转场做成段落样式

script.js · 第68–72行在完整代码中
const PAREN = 3.1;
const paragraphStyles = [
  { id: 'paren', firstLineIndent: mm((PAREN - DIALOGUE.left) * IN) }, // inside a speech
  { id: 'transition', textAlign: 'right' }, // CUT TO:, flush with the action's right edge
];

台词中的:::paragraphs{style="paren"}容器把首行从对白左边缘再缩进0.6英寸,到3.1英寸处(段落样式)。括号提示请保持一行:该样式只缩进首行。对白样式的body.paragraphSpacing: false让动作描写段落之间的空行不进入框内,所以(then)紧贴在上一行下面。CUT TO:和FADE OUT.放在transition容器中,其textAlign: 'right'让它们与动作描写行的末端对齐。容器在最后一段之后让文字流回到基线网格上;这份剧本从不离开网格,所以CUT TO:之后的标题保留两个空行。

#4 · 在两侧页边距挂出场号

script.js · 第76–105行在完整代码中
// Each number sits in a box half an inch wide, text aligned left, so that 9, 12 and an
// inserted 12A start at the same place on both sides.
const NUMBER_W = 0.5; // inches
const number = (id, edge, x) => ({ kind: 'text', id, content: '{number}', fontFamily: TEXT,
  fontSize: pt(12), fontWeight: 700, lineHeight: 1, color: col('ink'), align: 'left',
  placement: { ...at('container', edge, x * IN), size: { width: mm(NUMBER_W * IN) } } });
// The heading's own text is not painted but still measured: at the level's default 15 pt,
// scene 1's heading would wrap and reserve a second line.
const slugline = { level: 2, fontSize: pt(12), lineHeight: pt(LEAD),
  marginTop: pt(2 * LEAD), marginBottom: pt(LEAD), // two blank lines above, one below
  numberingTemplate: '{2}', // the scene count, which {number} prints
  advancedDesign: { enabled: true, slot: { elements: [
    { kind: 'text', id: 'heading', content: '{titleText}', fontFamily: TEXT, fontSize: pt(12),
      fontWeight: 700, lineHeight: 1, color: col('ink'), align: 'left', overflow: 'wrap',
      placement: { ...at('container', 'top-left'), size: { width: 'fill' } } },
    number('left', 'top-left', -0.6), // starts at 0.9 inches from the edge of the sheet
    number('right', 'top-right', 0.25 + NUMBER_W), // starts a quarter inch past the text
  ] } } };
const headings = {
  // The family of the speech titles, and the one the headings' unpainted text is measured
  // in (left unset, a sixth face, Open Sans Bold, would be loaded for nothing).
  fontFamily: TEXT,
  // Script pages end where the last whole speech or paragraph ends. Balancing would add
  // blank lines above the sluglines to fill them.
  balancing: { enabled: false },
  levels: [
    // 'any': the cover, its inside and the title each open the next page, with no blank.
    { level: 1, breakBefore: { enabled: true, parity: 'any' } },
    slugline,
  ] };

numberingTemplate: '{2}'对二级标题计数,{number}在设计中印出这个计数(按级别覆盖)。带高级设计的标题在栏中保留自己的位置,但画的是设计元素而不是标题文字(通栏与高级设计),所以两个场号可以立在加粗标题两侧的页边距里。每个场号都锚定在标题自身的框上,再推到框外:左边推出0.6英寸,右边越过文字末端四分之一英寸;场号放在半英寸宽、文字齐左的框里,这样剧本超过第9场后,一位数和两位数的场号起点相同。标题本身的文字不画出来,但仍参与测量,所以该级别设为12 pt:用默认的15 pt,第1场的标题会折行,多占一行。各栏齐底功能关闭:它会在场景标题上方添加空行来填满短页,而剧本的一页应当在最后一段台词或段落结束的地方结束。

#5 · 只在剧本页上打孔、编页码

script.js · 第109–129行在完整代码中
// Three holes down the bound edge, 4.25 inches apart, as a three-hole punch leaves them.
const HOLES = [1.25, 5.5, 9.75].map((y) => y * IN); // mm: hole centres from the top
const EDGE = 0.375 * IN; // mm: from the bound edge to the centre of each hole
const HOLE = 7; // mm across
const punched = HOLES.map((y, i) => ({ kind: 'box', id: `punch${i}`,
  style: { backgroundColor: col('hole'), borderRadius: mm(HOLE / 2) },
  placement: { ...at('page', 'top-left', EDGE - HOLE / 2, y - HOLE / 2),
    size: { width: mm(HOLE), height: mm(HOLE) } } }));
// The script's first page opens with its title, an H1 that breaks the page, so the page is
// an 'opener' and pages: 'body' leaves it unnumbered, as the format asks.
const folio = { kind: 'text', id: 'folio', content: '{pageNumber}.', pages: 'body',
  fontFamily: TEXT, fontSize: pt(12), color: col('ink'), align: 'right',
  placement: at('page', 'top-right', -MARGIN.right * IN, 0.5 * IN) };
// The title's style carries the header of its section: the pages from the title to the end.
const title = { id: 'script', header: { elements: [...punched, folio] },
  advancedDesign: { enabled: true, slot: { elements: [
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: TEXT, fontSize: pt(12),
      lineHeight: 1, textTransform: 'uppercase', color: col('ink'), align: 'center',
      placement: { ...at('container', 'top'), size: { width: 'fill' } } },
  ] } }, // H1's own line, 1.2 × 18 pt, would reserve 21.6 pt and drop FADE IN: 9.6 pt
  lineHeight: pt(LEAD), marginBottom: pt(LEAD) };

剧本的标题样式带有自己的header,在它所在部分的各页上(从标题到结尾)取代文档的页眉(标题样式)。文档本身的页眉是空的,所以孔和页码只印在剧本页上。页码锚定在距纸顶半英寸处,pages: 'body'让它不出现在章首页上(文本元素)。标题是分页的一级标题,所以第1页是章首页,不印页码,正符合格式要求。两页封面也是一级标题;封面内侧与标题之间的:::numbering{startAt=1}让标题所在页编为1,下一页印2。标题样式设了12 pt的行;若用一级标题自己的18 pt,标题会排在21.6 pt的行上,把FADE IN:往下推9.6 pt。

完整食谱

沙盒
// ═══ Postext Cookbook · Nº 061 · Screenplay format ═══════════════════════════════
// https://postext.dev/en/cookbook/screenplay-format
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Courier Prime, Oswald (SIL OFL 1.1), Special Elite (Apache 2.0) · Needs postext ≥ 1.25.0
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';

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

// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // black type on white bond, and a card cover in goldenrod
  ink: '#1b1b1b', // every line of the script
  paper: '#ffffff',
  hole: '#e3e1db', // the punched holes down the left edge of each script page
  card: '#e6b84a', // the cover stock
  cardDark: '#b98a2a', // the label's shadow and the rims of the punched holes
  cardInk: '#4a3510', // the small print on the cover (6.3:1 on the card)
  brass: '#a8812f', // the brads
  brassLight: '#e9cf82', // the glint on each brad
  stamp: '#8f231c', // the draft stamp (4.7:1 on the card)
};
// Every colour is linked to its palette entry by id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
// The engine's defaults link to main-color: pointed at the ink, anything left unset prints black.
const colorPalette = Object.entries({ ...palette, 'main-color': palette.ink })
  .map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const TEXT = 'Courier Prime';
const IN = 25.4; // mm in an inch: the format is specified in inches
const LEAD = 12; // pt: 12-point Courier at six lines to the inch, so one line is one grid line
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region page: US Letter, a 1.5-inch binding margin, Courier 12 on 12, ragged right
const MARGIN = { top: 1, bottom: 1, left: 1.5, right: 1 }; // inches: the left one takes the brads
const page = { sizePreset: 'custom', width: mm(8.5 * IN), height: mm(11 * IN), dpi: 150,
  margins: { top: mm(MARGIN.top * IN), bottom: mm(MARGIN.bottom * IN),
    left: mm(MARGIN.left * IN), right: mm(MARGIN.right * IN) } };
const bodyText = { fontFamily: TEXT, fontSize: pt(12), lineHeight: pt(LEAD), color: col('ink'),
  textAlign: 'left', firstLineIndent: pt(0), // action: flush left, never justified
  paragraphSpacing: true }; // a blank line between paragraphs
// #endregion

// #region answer: a speech is a callout with no frame, padded to the 3.5-inch dialogue block
// Positions from the left edge of the sheet, in inches, as screenwriting software gives them.
const DIALOGUE = { left: 2.5, right: 6 }; // the block of speech, 3.5 inches wide
const CUE = 3.7; // the character's name
const TEXT_RIGHT = 8.5 - MARGIN.right; // 7.5: where action lines end
const dialogue = {
  id: 'dialogue',

组合好的script.js可以直接运行:把它粘贴到任何页面的模块脚本中,或在CodePen上打开这道食谱。 GitHub上的食谱文件夹 ↗ (在新标签页中打开)

变化

#让台词重新吸附网格

这样每段台词保留自己的下外边距,下一段再加上它的上外边距,台词之间就留出两个空行(场景标题前是三个),剧本会排到第四页。

-  snapToGrid: false,
 };

#场景标题用常规字重

打字机时代的剧本,场景标题用普通大写字母;加粗是编剧软件出现后才有的。

-  fontSize: pt(12), fontWeight: 700, lineHeight: 1, color: col('ink'), align: 'left',
+  fontSize: pt(12), fontWeight: 400, lineHeight: 1, color: col('ink'), align: 'left',
-      fontWeight: 700, lineHeight: 1, color: col('ink'), align: 'left', overflow: 'wrap',
+      fontWeight: 400, lineHeight: 1, color: col('ink'), align: 'left', overflow: 'wrap',

常见问题

  • 台词跨页断开时,Postext不会在下方印(MORE),也不会在后半段上方重复角色名。请把keepTogether保持默认值,让台词整段移到下一页。
  • 编剧软件会自动在角色名后加(CONT'D)。这里它是围栏中title的一部分,所以角色的台词在一行动作描写之后继续时,要自己输入。
  • titleStyle.lineHeight只有在等于正文行距时,才能让台词留在网格上。角色名字号更大或更小时,仍要用这12 pt,否则每段台词都会把后面的行推离网格。

致谢

文本
原创文字, CC BY 4.0
字体
Courier Prime (SIL OFL 1.1) · Special Elite (Apache 2.0) · Oswald (SIL OFL 1.1)
沙盒