Text poured into columns

One long passage poured into three columns, each fitting the lines its height allows and handing the rest to the next.

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_columns.json 99 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.

The library breaks the passage once, to the width of one column, then hands each column as many of the broken lines as its height allows. A request has no block of words that runs from the foot of one column into the head of the next, so the passage travels as three blocks, each already holding the words its column was handed. The lines fall in the same places, because a line is broken against the room in front of it. The first two columns stop in the middle of the passage and say so, for their last line to be spaced out like the ones above it; the third ends the passage and leaves its last line ragged. The library also draws the rule around a column as a rectangle, where a rectangle on the wire is its four corners walked round and closed.

 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
{
  "items": [
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 590.0,
        "urx": 215.0,
        "ury": 720.0
      },
      "content": "A flow too long for one column is set column by column. Each column takes as many of the broken lines as its height allows, draws them, and hands the rest to the column beside it, which takes up exactly where the last one stopped. The words",
      "font": "DejaVuSans",
      "font_size": 10.0,
      "align": "justify",
      "leading": 14.0,
      "last_align": "justify"
    },
    {
      "type": "rect",
      "rect": {
        "llx": 70.0,
        "lly": 590.0,
        "urx": 215.0,
        "ury": 720.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 240.0,
        "lly": 590.0,
        "urx": 385.0,
        "ury": 720.0
      },
      "content": "are broken once, to the width one column has, so every column is set to the same measure. A line that would fall below a column's foot opens the next column instead, and the reading runs down one column and on into the top of the next",
      "font": "DejaVuSans",
      "font_size": 10.0,
      "align": "justify",
      "leading": 14.0,
      "last_align": "justify"
    },
    {
      "type": "rect",
      "rect": {
        "llx": 240.0,
        "lly": 590.0,
        "urx": 385.0,
        "ury": 720.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 410.0,
        "lly": 590.0,
        "urx": 555.0,
        "ury": 720.0
      },
      "content": "with no line lost and none set twice. This is what sets a newspaper's text, a report's two columns, or the narrow measure a wide page reads best in.",
      "font": "DejaVuSans",
      "font_size": 10.0,
      "align": "justify",
      "leading": 14.0
    },
    {
      "type": "rect",
      "rect": {
        "llx": 410.0,
        "lly": 590.0,
        "urx": 555.0,
        "ury": 720.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    }
  ]
}