A font behind the font

One line of statuses set twice: in a company font alone, where the marks it has no glyph for come out as empty boxes, then with a second font behind it that draws them.

This page is the whole program, for whoever writes your software. There is nothing here to read otherwise. Go back to the document it writes.

JSON write_font_fallback.json 171 lines

This one is not a program. It is the request the document server is sent: the same page, asked for over the network by an application that writes no PDF code at all.

This request writes out three figures the library reads for itself: that the line is cut into seven stretches by the two faces between them, and the two names those faces give themselves. The count moves whenever the line or either face's coverage moves, and the names move whenever either file is replaced; here they are typed in, and would have to be typed in again. Two of the three columns at the foot are given a rectangle running past the right edge of the sheet, harmlessly: nothing in them is anywhere near wide enough to break.

  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
{
  "font_chains": [
    {"name": "chained", "faces": ["plex", "DejaVuSans"]}
  ],
  "items": [
    {
      "type": "text",
      "rect": {"llx": 60, "lly": 758.4, "urx": 535, "ury": 780},
      "content": ["A font behind the font"],
      "font": "plex",
      "font_size": 18
    },
    {
      "type": "text",
      "rect": {"llx": 60, "lly": 694, "urx": 535, "ury": 750},
      "content": ["A house font rarely covers every character a document has to draw. Without a second font behind it, a character it has no glyph for comes out as the empty box below, and a reader is left guessing.\nA chain hands that character to the next font instead, so the line is set in as many fonts as it takes and every mark is drawn."],
      "font": "chained",
      "font_size": 10,
      "leading": 14
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 639.2, "urx": 535, "ury": 650},
      "content": ["The house font alone: what it has no glyph for, it cannot draw."],
      "font": "plex",
      "font_size": 9
    },
    {
      "type": "text",
      "rect": {"llx": 60, "lly": 598, "urx": 535, "ury": 616},
      "content": ["✓ Paid · ★ Priority · ☂ Weather hold · ✗ Refused"],
      "font": "plex",
      "font_size": 15
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 549.2, "urx": 535, "ury": 560},
      "content": ["The house font, with a second one behind it."],
      "font": "plex",
      "font_size": 9
    },
    {
      "type": "text",
      "rect": {"llx": 60, "lly": 508, "urx": 535, "ury": 526},
      "content": ["✓ Paid · ★ Priority · ☂ Weather hold · ✗ Refused"],
      "font": "chained",
      "font_size": 15
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 442, "urx": 535, "ury": 470},
      "content": ["The line above is cut into 7 stretches, drawn by two fonts: IBMPlexSans, then DejaVuSans. The words are in the first; the marks it lacks are in the second."],
      "font": "chained",
      "font_size": 10,
      "leading": 14
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 389.2, "urx": 535, "ury": 400},
      "content": ["Mark"],
      "font": "plex",
      "font_size": 9
    },
    {
      "type": "text",
      "rect": {"llx": 106, "lly": 389.2, "urx": 581, "ury": 400},
      "content": ["Status"],
      "font": "plex",
      "font_size": 9
    },
    {
      "type": "text",
      "rect": {"llx": 236, "lly": 389.2, "urx": 711, "ury": 400},
      "content": ["Drawn by"],
      "font": "plex",
      "font_size": 9
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 358, "urx": 535, "ury": 382},
      "content": ["✓"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 106, "lly": 358, "urx": 581, "ury": 382},
      "content": ["Paid"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 236, "lly": 358, "urx": 711, "ury": 382},
      "content": ["IBMPlexSans"],
      "font": "chained",
      "font_size": 10
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 340, "urx": 535, "ury": 364},
      "content": ["★"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 106, "lly": 340, "urx": 581, "ury": 364},
      "content": ["Priority"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 236, "lly": 340, "urx": 711, "ury": 364},
      "content": ["DejaVuSans"],
      "font": "chained",
      "font_size": 10
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 322, "urx": 535, "ury": 346},
      "content": ["☂"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 106, "lly": 322, "urx": 581, "ury": 346},
      "content": ["Weather hold"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 236, "lly": 322, "urx": 711, "ury": 346},
      "content": ["DejaVuSans"],
      "font": "chained",
      "font_size": 10
    },

    {
      "type": "text",
      "rect": {"llx": 60, "lly": 304, "urx": 535, "ury": 328},
      "content": ["✗"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 106, "lly": 304, "urx": 581, "ury": 328},
      "content": ["Refused"],
      "font": "chained",
      "font_size": 10
    },
    {
      "type": "text",
      "rect": {"llx": 236, "lly": 304, "urx": 711, "ury": 328},
      "content": ["DejaVuSans"],
      "font": "chained",
      "font_size": 10
    }
  ]
}