write_articles.json

Die JSON-Datei des Beispiels „Eine Geschichte, die weiter hinten fortgesetzt wird“. Zwei Artikel über zwei Seiten: Jeder beginnt in einer Spalte der Titelseite und geht in einer Spalte der zweiten weiter, und die beiden tauschen unterwegs die Seiten. Die Datei sagt, welche Spalte auf welche folgt, sodass die Anzeigesoftware mit dem Artikel fortfährt, bei dem der Leser ist.

JSON 295 Zeilen

Diese Datei ist eine Anfrage: Eine Anwendung sendet sie über das Netz an den Server, der das PDF erzeugt und zurücksendet. Sie erzeugt dieselbe Seite wie die Rust- und die Python-Fassung dieses Beispiels. Eine Anfrage nennt jede Datei, die sie verwendet, nie ihren Inhalt; der Aufruf trägt die Anfrage und die Dateien zusammen. Eine Schrift, die der Server bereits vorhält, etwa DejaVuSans, wird ohne Anhang genannt. Senden Sie die Anfrage an die Adresse, die die API-Seite angibt.

Die Bibliothek bricht jede Geschichte einmal um, auf die Breite einer Spalte, und gibt dann dem ersten Bereich so viele der umbrochenen Zeilen, wie er Platz hat, und dem zweiten Bereich den Rest. Eine Anfrage kennt keinen Wortblock, der vom Fuß eines Bereichs in den Kopf des nächsten läuft, daher reist jede Geschichte als zwei Blöcke, jeder bereits mit den Wörtern, die sein Bereich erhalten hat. Die Zeilen fallen an dieselben Stellen, denn eine Zeile wird gegen den Raum vor ihr umbrochen, und der Block, der mitten in seiner Geschichte aufhört, sagt es, damit seine letzte Zeile so verteilt wird wie die darüber. Die Lesereihenfolge selbst wird auf beiden Seiten auf dieselbe Weise verlangt: zwei Geschichten, jede nennt die zwei Bereiche, über die sie gelesen wird. Die Bibliothek setzt jede Überschrift in 12 Punkt oder kleiner, wenn sie nicht über ihre Spalte passen würde; eine Anfrage schreibt die Größe aus, bei der die Bibliothek ankommt, 9,503371659770956 Punkt für die fortgesetzte Überschrift der Ernte.

Wofür dieses Beispiel da ist

Eine Zeitung bringt drei Geschichten auf ihre Titelseite und beendet keine davon dort. Auf Papier kommt das Auge zurecht: Man liest bis zum Fuß einer Spalte, blättert um und sucht die Überschrift wieder. Am Bildschirm ist diese Suche schlimmer, denn die Spalte unter der, die man gerade gelesen hat, gehört zu einer anderen Geschichte und sieht genauso aus.

Was dieses Beispiel zeigt

  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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
{
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 70.0,
        "lly": 780.0,
        "urx": 525.0,
        "ury": 806.4
      },
      "content": [
        "The Thursday Sheet"
      ],
      "font": "DejaVuSans",
      "font_size": 22.0,
      "pages": [1]
    },
    {
      "type": "text",
      "rect": {
        "llx": 70.0,
        "lly": 762.0,
        "urx": 525.0,
        "ury": 772.8
      },
      "content": [
        "Two stories, four columns, and a reading order of their own."
      ],
      "font": "DejaVuSans",
      "font_size": 9.0,
      "pages": [1]
    },
    {
      "type": "line",
      "from": {
        "x": 70.0,
        "y": 752.0
      },
      "to": {
        "x": 525.0,
        "y": 752.0
      },
      "stroke": {
        "width": 1.0
      },
      "pages": [1]
    },
    {
      "type": "rect",
      "rect": {
        "llx": 70.0,
        "lly": 510.0,
        "urx": 285.0,
        "ury": 700.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.75,
          0.75,
          0.75
        ]
      },
      "pages": [1]
    },
    {
      "type": "text",
      "rect": {
        "llx": 76.0,
        "lly": 684.0,
        "urx": 560.0,
        "ury": 698.4
      },
      "content": [
        "The bridge reopens"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0,
      "pages": [1]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 76.0,
        "lly": 510.0,
        "urx": 279.0,
        "ury": 674.0
      },
      "content": "The bridge reopened on Tuesday, eleven months after the river took the middle of it. The county surveyor walked the deck at dawn and declared it sound, which is the only ceremony anyone asked for. Traffic crossed within the hour. What took the eleven months was not the deck but the two piers under it, each rebuilt from the bed up while the water ran round them. The contractor counted nineteen days lost to the weather and none at all to the design, which is a rarer thing than it sounds. The old approach road stays shut until the spring, so",
      "font": "DejaVuSans",
      "font_size": 9.0,
      "align": "justify",
      "leading": 12.5,
      "last_align": "justify",
      "pages": [1]
    },
    {
      "type": "rect",
      "rect": {
        "llx": 310.0,
        "lly": 510.0,
        "urx": 525.0,
        "ury": 700.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.75,
          0.75,
          0.75
        ]
      },
      "pages": [1]
    },
    {
      "type": "text",
      "rect": {
        "llx": 316.0,
        "lly": 684.0,
        "urx": 560.0,
        "ury": 698.4
      },
      "content": [
        "The harvest, county by county"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0,
      "pages": [1]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 316.0,
        "lly": 510.0,
        "urx": 519.0,
        "ury": 674.0
      },
      "content": "The wheat came in ten days early and heavier than anyone had allowed for, and the barns of three parishes were full before the second week of August. The dry June is what did it, say the growers, and the wet April before that. Not every field agrees: the high ground east of the ridge lost a third of what it stood to a wind that came through on a single afternoon. The merchants have held their price so far, which nobody expects to last past the sales, and the millers are already asking what the winter sowing will look like on ground this hard.",
      "font": "DejaVuSans",
      "font_size": 9.0,
      "align": "justify",
      "leading": 12.5,
      "last_align": "justify",
      "pages": [1]
    },
    {
      "type": "rect",
      "rect": {
        "llx": 310.0,
        "lly": 570.0,
        "urx": 525.0,
        "ury": 760.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.75,
          0.75,
          0.75
        ]
      },
      "pages": [2]
    },
    {
      "type": "text",
      "rect": {
        "llx": 316.0,
        "lly": 744.0,
        "urx": 560.0,
        "ury": 758.4
      },
      "content": [
        "The bridge reopens (continued)"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0,
      "pages": [2]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 316.0,
        "lly": 570.0,
        "urx": 519.0,
        "ury": 734.0
      },
      "content": "the lorries still go the long way round by the mill. The parish council has asked for a footway on the upstream side and been told it will wait its turn. Meanwhile the bus takes four minutes off its run and the school on the far bank has moved its bell back to where it stood before the flood. Nobody has yet said what becomes of the temporary crossing downstream, which cost more to keep open than to build and which the anglers would like left where it is.",
      "font": "DejaVuSans",
      "font_size": 9.0,
      "align": "justify",
      "leading": 12.5,
      "pages": [2]
    },
    {
      "type": "rect",
      "rect": {
        "llx": 70.0,
        "lly": 570.0,
        "urx": 285.0,
        "ury": 760.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.75,
          0.75,
          0.75
        ]
      },
      "pages": [2]
    },
    {
      "type": "text",
      "rect": {
        "llx": 76.0,
        "lly": 744.0,
        "urx": 560.0,
        "ury": 755.4040459917252
      },
      "content": [
        "The harvest, county by county (continued)"
      ],
      "font": "DejaVuSans",
      "font_size": 9.503371659770956,
      "pages": [2]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 76.0,
        "lly": 570.0,
        "urx": 279.0,
        "ury": 734.0
      },
      "content": "The straw is the other half of the story: there is a great deal of it, it is dry, and the men who bale it have been working the fields two counties away as well as their own. Two of the larger farms have put their second cut off a fortnight in the hope of rain. The weighbridge at the co-operative has been open since six every morning and the queue at seven is longer than it was last year at nine.",
      "font": "DejaVuSans",
      "font_size": 9.0,
      "align": "justify",
      "leading": 12.5,
      "pages": [2]
    }
  ],
  "articles": [
    {
      "title": "The bridge reopens",
      "author": "Claire Vasseur",
      "subject": "The Thursday Sheet",
      "keywords": "newsletter, workshop, weekly",
      "patches": [
        {
          "page": 1,
          "llx": 70.0,
          "lly": 510.0,
          "urx": 285.0,
          "ury": 700.0
        },
        {
          "page": 2,
          "llx": 310.0,
          "lly": 570.0,
          "urx": 525.0,
          "ury": 760.0
        }
      ]
    },
    {
      "title": "The harvest, county by county",
      "author": "Martin Aubert",
      "subject": "The Thursday Sheet",
      "keywords": "newsletter, workshop, weekly",
      "patches": [
        {
          "page": 1,
          "llx": 310.0,
          "lly": 510.0,
          "urx": 525.0,
          "ury": 700.0
        },
        {
          "page": 2,
          "llx": 70.0,
          "lly": 570.0,
          "urx": 285.0,
          "ury": 760.0
        }
      ]
    }
  ],
  "metadata": {
    "title": "The Thursday Sheet"
  },
  "reading": {
    "page_layout": "two_columns_odd_left"
  }
}