Supporters update.
[dcpomatic.git] / doc / design / fonts
1 How a font makes its way through the encoding process
2
3
4 Import a DCP containing some subtitles with fonts.
5
6 * Examiner
7
8 Builds _fonts containing (font-ID, font-TTF-data)
9 Add to allocator (asset-ID, font-ID)
10
11 font-ID will be unique in its own asset, but not more widely.
12
13 Use the allocator to set the font ID to N_font-ID where N is an integer unique for all fonts in the DCP.
14
15 If there's no fonts in the DCP, add one with an empty ID - we want something in the content for users
16 to edit.
17
18
19 Now the text content contains fonts with IDs unique within the content.
20
21
22 * DCP Decoder
23
24 Some subtitle arrives with an "original" font ID.
25 Use an allocator (built the same way as in the examiner) to replace the ID with a new one N_font-ID.
26
27
28 Q: Why do we need the allocator?
29 A: Because we need an ID to refer to each font in the content (to be stored in metadata.xml)
30    and we need to turn this ID back into an actual Font C++ object so it must be unique within
31    the content.  Also we allow these fonts to have their settings altered so they must have unique
32    IDs for that.
33
34
35 * Text Decoder
36
37 Calls content->get_font() to get the Font C++ object by the (newly-allocated) ID.  This works because
38 the allocated font-ID is unique within the content.
39
40 The Font C++ object pointer is written to the subtitle.
41
42
43 * Player
44
45 Passes subtitles through.
46
47
48 * Writer
49
50 Gets all fonts, puts them in the font ID map using the font's original ID.  This is OK because we
51 don't need uniqueness in the DCP any more.
52
53
54 * Reel Writer
55
56 Gets subtitles, uses font ID map to find the ID from the Font C++ object pointer.  Puts this ID in
57 the font and writes it to the asset.  Ensures the required LoadFont is added.
58
59