-
Notifications
You must be signed in to change notification settings - Fork 121
/
fileformat.txt
242 lines (147 loc) · 7.34 KB
/
fileformat.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
The screenplay is represented as a series of lines. Lines are separated by
a single byte 0x0A. The file is encoded in UTF-8, and begins with the
Unicode byte order mark (BOM), i.e. the bytes "EF BB BF".
After the BOM, the first line contains "#Version x", where x is the
file format number, currently either 1, 2 or 3.
If file format is 2, configuration sections come next. They are of the
form "#Begin-X ", [lines belonging to X], "#End-X ". Each line in the
middle is of the type "key:value".
Config values can be booleans, integers, floating point values, text
strings, or lists. Booleans are either "True" or "False", integers are
[0-9]+, floating point values are [0-9]+\.[0-9]+, text strings are
all the characters between ":" and "\n".
If you have a a config directive named Foo that is a list, the format is:
Foo:2
Foo/1:val1
Foo/2:val2
i.e. the directive itself contains the number of items in the list, and
then key-name/x items contain the list values, where x is in the range [1,
list-size].
The following config sections exists and appear in the file in this order:
Auto-Completion/([Scene|Character|Transition]):
Enabled (boolean): Whether auto-completion is on.
Items (list of strings): Auto-completion values.
Config:
FontSize (int): Font size in the PDF output in 1/72 inch units.
Margin/(Bottom|Left|Right|Top) (floating point): Margins in millimeters.
Paper/(Height|Width) (floating point): Paper size in millimeters.
PageBreakActionLines (integer): How many lines of action must be left on
bottom of a page.
PageBreakDialogueLines (integer): How many lines of dialogue must be
left on bottom of a page.
SceneContinueds (boolean): Whether to include scene continueds.
SceneContinuedIndent (integer): How many characters to indent the
"(CONTINUED)" text from the left margin.
ShowSceneNumbers (boolean): Whether to include scene numbers.
ShowMargins (boolean): Whether to show margins by drawing lines.
ShowLineNumbers (boolean): Whether to prefix each line with its line
number.
IncludeTOC (boolean): Whether to add a table of contents.
ShowTOC (boolean): Whether to show the table of contents when opening
the PDF file.
OpenOnCurrentPage (boolean): If True, display current page in the PDF
file when opening it.
RemoveNotes (boolean): Whether to remove Note elements from PDF output.
OutlineNotes (boolean): Whether to draw a rectangle around Note elements
in PDF output.
Cursor/(Line|Column) (integer): Cursor position.
String/(MoreDialogue|ContinuedPageEnd|ContinuedPageStart|
DialogueContinued) (string): The "(MORE)", "(CONTINUED)", "CONTINUED:",
" (cont'd)" texts to use.
Font/(Normal|Bold|Italic|Bold-Italic)/(Name|Filename) (string): If using
user-specified Courier fonts, these contain the Postscript name of the
font and if embedded in the PDF file, the filename of the .ttf file. See
the manual for details.
In addition, there are element-type specific config directives, which
are named "Element/x/y", where x is (Scene|Action|Character|Dialogue|
Parenthetical|Transition|Shot|Note|Act break) and y is one of:
BeforeSpacing (integer): How many lines to leave empty above a block,
in units of line * 10, i.e. a value of 15 would mean 1.5 lines.
IntraSpacing (integer): Like BeforeSpacing, but for intra-element
lines.
Indent (integer): How many characters to indent from the left margin.
Width (integer): How many characters wide, max.
The following are found twice, as "Screen/y" and "Export/y". The first
one is used to display the element on-screen, while the second one is
used when generating PDF output.
AllCaps (boolean): Whether to show text as all caps.
Bold: (boolean): Whether to bold text.
Italic: (boolean): Whether to italicize text.
Underlined: (boolean): Whether to underline text.
Locations:
Locations (list of lists of strings): Each inner list lists scene names
to treat as the same location.
Spell-Checker-Dict:
Words (list of strings): Script-specific spell checker dictionary.
After this (in version 1 files after "#Version 1") there is more
configuration, but in a different syntax, that is mostly due to historical
accidents.
These config lines are of the form: "#", "Config-Name", " " (space),
"Config-Value". Config-Value can be empty.
Config values (none are required):
"Title-Page". Value: None. Starts a new title page.
"Title-String". Adds a new string to the current title page. If no title
pages exist yet, creates one. Example:
0.000000,70.000000,24,cb,Helvetica,,text here
Format is: xpos,ypos,fontsize,flags,font,reserved,text
'xpos' and 'ypos' are floating point values, giving the offset in
millimeters of the upper-left corner of the text string from the
upper-left corner of the page.
'fontsize' is font size in points, e.g. 1/72 inch units.
'flags' contains any combination of the following characters:
c: Text is centered horizontally on the page. In this case xpos is not
used for anything.
r: Text is right-justified; meaning of xpos changes to mean the
rightmost edge of the last character.
b, i, u: Text is bold / italic / underlined.
'font' is the font name. Currently supported are Courier, Helvetica and
Times (Times-Roman).
'reserved' is reserved for future expansion and is empty for now.
'text' is the text string. Multi-line strings are indicated by embedded
\n escapes. The literal \ character is escaped as \\. For multi-line
string, each additional line's y position should be increased by the
font's size.
"Header-String". Adds a new header string. Example:
1,0,r,,${PAGE}.
Format is: line,xoff,flags,reserved,text
'line' is the 1-based line number.
'xoff' is the number of characters by which the string is offsetted in
the horizontal direction. Can be negative.
'flags' contains:
Any combination of the following characters:
b, i, u: Text is bold / italic / underlined.
One of the following characters:
l, c, r: Alignment is left / centered / right.
'reserved' is reserved for future expansion and is empty for now.
'text' is the text string.
"Header-Empty-Lines". Value: integer >= 0. If there are header lines, this
is the number of empty lines between headers and actual script contents.
If file format is >= 3, between the config data and the actual script data
is a "#Start-Script " line. With it, config sections can be added without
increasing the file format version number, as unknown config parts can be
skipped.
After the above, the actual script starts. Each line has two bytes at the
beginning that signal the type of linebreak at the end of that line and
the general type of the line, and everything after that is the text of the
line.
Linebreak types:
'>' - A single space.
'&' - Nothing.
'|' - Forced.
'.' - Last line of the element.
More linebreak types are possibly going to be added in the future without
increasing the fileformat version number, so unknown linebreak types
should be converted to '>', and a warning given to user about this.
Line types:
'\' - Scene heading.
'.' - Action.
'_' - Character.
':' - Dialogue.
'(' - Parenthetical.
'/' - Transition.
'=' - Shot
'%' - Note
More line types are probably going to be added in the future without
increasing the fileformat version number, so unknown line types should be
converted to Action, and a warning given to user about this.
See sample.trelby for an example screenplay.