write_lists.json

The JSON file of the “Lists made from an indent and a tab stop” example. Bulleted, numbered and nested lists, each built out of an indent that hangs out to the left and one tab stop rather than out of a dedicated list object: the marker sits in the room the indent opens, and every line below the first begins where the tabulation put the text.

JSON 125 lines

This file is a request: an application sends it over the network to the server, which creates the PDF and sends it back. It makes the same page as the Rust and Python versions of this example. A request names every file it uses, never its content; the call carries the request and the files together. A font the server already holds, such as DejaVuSans, is named with nothing attached. Send the request to the address the API page gives.

What this example is for

The giveaway of a document a program assembled is a list whose second line starts under the bullet instead of under the words. It is a small thing, and every word processor in the world gets it right.

What this example shows

  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
{
  "items": [
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 760.8,
        "urx": 280.0,
        "ury": 780.0
      },
      "content": "Bulleted: a bullet, a tabulation, and 14 points in front of the body.",
      "font": "DejaVuSans",
      "font_size": 8.0
    },
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 672.8,
        "urx": 280.0,
        "ury": 756.8
      },
      "content": "•\tEvery line below the first lines up with the words, not with the bullet.\n•\tThe marker hangs in the room the negative first-line indent opens.\n•\tA long item wraps inside the block and stays inside it.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 14.0,
      "hanging_list": {
        "marker": 0.0,
        "body": 14.0
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 320.0,
        "lly": 760.8,
        "urx": 530.0,
        "ury": 780.0
      },
      "content": "Numbered: the same block, widened to 22 points for the widest marker.",
      "font": "DejaVuSans",
      "font_size": 8.0
    },
    {
      "type": "flow",
      "rect": {
        "llx": 320.0,
        "lly": 658.8,
        "urx": 530.0,
        "ury": 756.8
      },
      "content": "1.\tA number hangs out to the left exactly as a bullet does.\n2.\tThe room in front is what the widest marker needs, not the narrowest.\n10.\tA two-figure number still ends before the stop the body begins at.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 14.0,
      "hanging_list": {
        "marker": 0.0,
        "body": 22.0
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 630.4,
        "urx": 530.0,
        "ury": 640.0
      },
      "content": "Nested: the inner list is the same block again, its markers standing where the outer bodies begin.",
      "font": "DejaVuSans",
      "font_size": 8.0
    },
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 612.4,
        "urx": 530.0,
        "ury": 626.4
      },
      "content": "1.\tPrepare the document, the font it draws through and the page it fills.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 14.0,
      "hanging_list": {
        "marker": 0.0,
        "body": 22.0
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 584.4,
        "urx": 530.0,
        "ury": 612.4
      },
      "content": "a.\tRead the font from its file and hand it to the document.\nb.\tName the page size, in points.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 14.0,
      "hanging_list": {
        "marker": 22.0,
        "body": 44.0
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 70.0,
        "lly": 570.4,
        "urx": 530.0,
        "ury": 584.4
      },
      "content": "2.\tAdd each page, with the content stream it was built from.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 14.0,
      "hanging_list": {
        "marker": 0.0,
        "body": 22.0
      }
    }
  ]
}