blob: 5d61f71a32f44cbf9f93a4b5c5d4e949ba0a4de2 (
plain)
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
|
How a font makes its way through the encoding process
Import a DCP containing some subtitles with fonts.
* Examiner
Builds _fonts containing (font-ID, font-TTF-data)
Add to allocator (asset-ID, font-ID)
font-ID will be unique in its own asset, but not more widely.
Use the allocator to set the font ID to N_font-ID where N is an integer unique for all fonts in the DCP.
If there's no fonts in the DCP, add one with an empty ID - we want something in the content for users
to edit.
Now the text content contains fonts with IDs unique within the content.
* DCP Decoder
Some subtitle arrives with an "original" font ID.
Use an allocator (built the same way as in the examiner) to replace the ID with a new one N_font-ID.
Q: Why do we need the allocator?
A: Because we need an ID to refer to each font in the content (to be stored in metadata.xml)
and we need to turn this ID back into an actual Font C++ object so it must be unique within
the content. Also we allow these fonts to have their settings altered so they must have unique
IDs for that.
* Text Decoder
Calls content->get_font() to get the Font C++ object by the (newly-allocated) ID. This works because
the allocated font-ID is unique within the content.
The Font C++ object pointer is written to the subtitle.
* Player
Passes subtitles through.
* Writer
Gets all fonts, puts them in the FontIDMap using the font's re-written ID.
* Reel Writer
Gets subtitles, uses FontIDMap to find the ID from the Font C++ object pointer. Puts this ID in
the font and writes it to the asset. Ensures the required LoadFont is added.
To put this all another way, we need to:
1. Make some Content-unique ID from a random font ID. Then we can store this in the metadata.xml, and the user can change the font.
2. Then do the same trick later, with the same result, so the decoder can receive the random font ID and go via the Content-unique
ID to get the actual font TTF from the Content.
In both these situations a string is the easiest thing (to go in some XML, and to go in a dcp::SubtitleString).
This whole problem really is just that a single TextContent represents multiple
DCP reels, and each reel can have a different font with the same font ID.
|