Skip to main content
Recipe number 61

Cookbook · Chapter 2 · Type & text

Screenplay format

A shooting script in Courier Prime 12 on US Letter, each speech a frameless callout padded to the dialogue block and each scene numbered in both margins.

On this page

pp. 2–1 · 2–3 of 5

  • Trim 215.9 × 279.4 mm
  • 1 column
  • Courier Prime 12/12
  • Oswald
  • Special Elite
  • 5 pages
  • Level
  • Postext 1.57.1
  • Laid out in 59 ms
  • 149 lines of code

In short

A short film script laid out the way film studios expect. It uses a typewriter-style font, with speeches and scene numbers set at fixed distances from the edge.

What you'll build

The shooting draft of Lost Property, an invented three-page short film, bound the way studio scripts are: a goldenrod card cover with two brass brads and a typed label, its inside stamped COPY 07, then the script, set 12 on 12 in Courier Prime on punched US Letter. The measures are those of screenwriting software: action from 1.5 to 7.5 inches, a speech from 2.5 to 6 under the character's name at 3.7, a parenthetical from 3.1, and CUT TO: and FADE OUT. ending at the right margin. Each scene heading carries its number in both margins. Script page 1 is unnumbered; the others print their number top right, with a full stop. Each speech is a callout with no frame, with the character's name set on the body's 12-pt leading, so action and dialogue keep six lines to the inch.

This recipe answers

  • How do I set a screenplay or a play: scene headings, character names, and dialogue indented from both sides?

The short answer

script.js · lines 43–64in full code
// 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,
};

A speech is a callout with no frame, padded to the 3.5-inch dialogue block

Ingredients

Type
Courier Prime, Oswald (SIL OFL 1.1) · Special Elite (Apache 2.0)
Assets
None: every picture is drawn in code

Method

#1 · Pad a box with no frame to the dialogue block

The code is in the short answer above. A callout's padding is measured from the text block, so 1 inch on the left and 1.5 inches on the right leave the 3.5-inch block that starts 2.5 inches from the edge of the sheet (callout styles). The character's name is the box's title, written in the fence as title="Dora (cont’d)". textTransform prints it in capitals, and indent moves it 1.2 inches past the padding, to 3.7 inches. gap is 0 because the default leaves half an em, 6 pt, between the name and the speech. By default a box title sits on a line 1.2 times its size, 14.4 pt here. titleStyle.lineHeight sets it on the body's 12 pt instead, so the name stands on a grid line and the speech is a whole number of 12-pt lines; at the default, each speech would push the text after it 2.4 pt further off the grid. With snapToGrid off, the bottom margin of one speech and the top margin of the next collapse into a single blank line. A box is kept whole by default, so a speech that no longer fits moves to the next page with its name.

#2 · Set the page in inches

script.js · lines 33–39in full code
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 with the 1.5-inch left margin that the brads go through, and an inch on the other three sides. Courier Prime is a monospace face: at 12 pt each letter is a tenth of an inch wide, so an action line holds 60 characters and a speech 35, and at 12 pt leading the page holds 54 lines. The text is set flush left, ragged right, and paragraphSpacing puts a blank line between paragraphs. Ragged text is hyphenated only when bodyText.hyphenation.ragged asks for it, so no word in the script is broken, as the format requires.

#3 · Make parentheticals and transitions paragraph styles

script.js · lines 68–72in full code
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
];

A :::paragraphs{style="paren"} container inside a speech indents its first line 0.6 inches past the dialogue edge, to 3.1 inches (paragraph styles). Keep parentheticals to one line: the style indents the first line only. The dialogue style's body.paragraphSpacing: false keeps the blank line of the action paragraphs out of the box, so (then) sits directly under the line before it. CUT TO: and FADE OUT. go in transition containers whose textAlign: 'right' sets them flush with the end of the action lines. A container returns the flow to the baseline grid after its last paragraph; this script never leaves the grid, so the heading after CUT TO: keeps its two blank lines.

#4 · Hang the scene numbers in both margins

script.js · lines 76–105in full code
// 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}' counts the level-2 headings, and {number} prints the count in the design (per-level overrides). A heading with an advanced design keeps its place in the column and draws its elements instead of its text (span and advanced design), so the two numbers can stand in the margins beside the bold heading. Each is anchored to the heading's own box and pushed out of it, 0.6 inches to the left and a quarter of an inch past the end of the text on the right, in a box half an inch wide with its text aligned left, so that in a script past scene 9 the one-digit and two-digit numbers start at the same place. The heading's own text is not painted but still measured, so the level is set to 12 pt: at the default 15 pt, the heading of scene 1 would wrap and reserve a second line. Column balancing is off: it would add blank lines above the scene headings to fill a short page, and a script page ends where its last speech or paragraph ends.

#5 · Punch and number the script's pages only

script.js · lines 109–129in full code
// 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) };

The script's title style carries its own header, which replaces the document's on the pages of its section, from the title to the end (heading styles). The document's own header is empty, so the holes and the page number print on the script only. The page number is anchored half an inch from the top of the sheet, and pages: 'body' keeps it off opening pages (text elements). The title is a level-1 heading that breaks the page, so page 1 is an opening page and prints no number, as the format asks. The covers are level-1 headings too; :::numbering{startAt=1} between the inside cover and the title gives the title's page the number 1, and the next page prints 2. The title's style sets a 12 pt line; at level 1's own 18 pt, the heading would sit on a 21.6 pt line and push FADE IN: 9.6 pt down.

The whole recipe

Sandbox
// ═══ 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',

The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)

Variations

#Snap the speeches back to the grid

Each speech then keeps its bottom margin and the next one adds its top margin, which leaves two blank lines between speeches (three before a scene heading) and pushes the script onto a fourth page.

-  snapToGrid: false,
 };

#Type the scene headings in regular weight

Typewritten scripts had their scene headings in plain capitals; bold arrived with screenwriting software.

-  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',

Pitfalls

  • Postext does not print (MORE) under a speech that breaks across pages or repeat the name above the rest of it. Leave keepTogether at its default so that a speech moves to the next page whole.
  • Screenwriting software adds (CONT'D) to a name automatically. Here it is part of the fence's title, so type it yourself where a character's speech resumes after a line of action.
  • titleStyle.lineHeight keeps a speech on the grid only while it equals the body's leading. A name set larger or smaller than the text still takes that 12 pt, or each speech moves the lines after it off the grid.

Credits

Text
Original prose, CC BY 4.0
Fonts
Courier Prime (SIL OFL 1.1) · Special Elite (Apache 2.0) · Oswald (SIL OFL 1.1)
Sandbox