Changing style in the middle of a paragraph

A paragraph whose style changes inside it: size, underline, colour.

JSON write_rich_text.json 112 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.

  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
{
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 784.0,
        "urx": 539.276,
        "ury": 800.8
      },
      "content": [
        "Rich text: styles, sizes, underlining, colour"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 720.4,
        "urx": 476.0,
        "ury": 760.0
      },
      "content": [
        "The amount due is ",
        {
          "text": "1 240.00 EUR",
          "underline": true
        },
        ", payable within thirty days. The balance carries interest at the statutory rate from the day it falls due, and no reminder has to be sent for it to do so."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "align": "justify"
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 660.8,
        "urx": 476.0,
        "ury": 694.4
      },
      "content": [
        "A line is as tall as ",
        {
          "text": "the largest",
          "font_size": 17.0
        },
        " of the styles standing on it, and no taller."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 621.6,
        "urx": 476.0,
        "ury": 634.8
      },
      "content": [
        "A run can carry its own ",
        {
          "text": "colour",
          "color": [0.0, 0.35, 0.7]
        },
        ", set apart from the black around it."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 569.2,
        "urx": 476.0,
        "ury": 595.6
      },
      "content": [
        "A word may change style in the middle: under",
        {
          "text": "lined",
          "underline": true
        },
        " is still one word, and is never broken at the join."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 533.6,
        "urx": 476.0,
        "ury": 543.2
      },
      "content": [
        "The small print sits in small type, ",
        "flush right",
        ", below the body of the text."
      ],
      "font": "DejaVuSans",
      "font_size": 8.0,
      "align": "right"
    }
  ]
}