Une page dont les lettres coûtent un octet chacune

Les mêmes trois lignes écrites deux fois — de la façon courante, puis avec chaque lettre tenue sur un seul octet — et la page dit ce que chacune des deux a coûté. La façon courte permet en plus d'écarter les mots d'une ligne, là où la façon courante ne laisse rien à écarter.

Cette page est le programme entier, pour celui qui écrit vos logiciels. Il n'y a rien d'autre à y lire. Revenir au document qu'il écrit.

JSON write_simple_encoding.json 117 lignes

Celui-ci n'est pas un programme. C'est la requête envoyée au serveur de documents : la même page, demandée par le réseau, par une application qui n'écrit pas une ligne de code PDF.

Cette demande écrit en clair ce que la bibliothèque compte pour elle-même : les trois lignes ci-dessus coûtent 541 octets de flux de page dessinées d'une façon et 347 dessinées de l'autre, soit 194 de moins, et les huit premiers codes que l'encodage a fixés partent de 33. La bibliothèque lit les deux poids sur deux pages jetables qu'elle écrit pour cela, et relit les codes dans l'encodage, si bien que tous suivent ce qu'elle écrit dans une page ; ici ils sont écrits à la main, et il faudrait les réécrire. La bibliothèque calcule aussi le haut de chaque bloc à partir de l'endroit où le bloc précédent s'est arrêté, là où la demande énonce les quatorze hauteurs en chiffres, et elle pose un gris avant la note de fin puis annonce du noir dans la note elle-même, si bien que le gris ne peint rien ; la demande n'annonce aucune couleur à cet endroit et dessine la même page avec une instruction de moins.

  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
{
  "simple_fonts": [
    {
      "name": "coded",
      "from": "DejaVuSans",
      "fitted_to": "HQF DevelopmentAn invoice, a payslip, a delivery note.One byte a letter, and the file says which.Words a reader can push apart."
    }
  ],
  "items": [
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 758.4, "urx": 522, "ury": 780 },
      "content": "A page addressed by one-byte codes",
      "font": "DejaVuSans",
      "font_size": 18
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 684.4, "urx": 522, "ury": 744.4 },
      "content": "Every letter on the three lines below costs one byte of this file's page stream instead of two. A font is reached by glyph index unless it is told otherwise, two bytes a glyph, which puts every glyph the face holds within reach. Reached through an encoding it is addressed by one-byte codes instead: at most 255 of them, each standing for one character, and the file states which character each of them stands for.",
      "font": "DejaVuSans",
      "font_size": 10
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 648, "urx": 522, "ury": 662.4 },
      "content": "Set through one-byte codes",
      "font": "DejaVuSans",
      "font_size": 12
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 619.2, "urx": 522, "ury": 636 },
      "content": "HQF Development",
      "font": "coded",
      "font_size": 14
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 594.4, "urx": 522, "ury": 611.2 },
      "content": "An invoice, a payslip, a delivery note.",
      "font": "coded",
      "font_size": 14
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 569.6, "urx": 522, "ury": 586.4 },
      "content": "One byte a letter, and the file says which.",
      "font": "coded",
      "font_size": 14
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 533.2, "urx": 522, "ury": 547.6 },
      "content": "The codes it settled",
      "font": "DejaVuSans",
      "font_size": 12
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 475.2, "urx": 522, "ury": 523.2 },
      "content": "The encoding is fitted to the words this page draws: the space keeps code 32, and every other character takes the lowest code free from 33 up, so nothing in the stream is a byte a reader has to escape. The first of them are H 33 · Q 34 · F 35 · D 36 · e 37 · v 38 · l 39 · o 40.",
      "font": "DejaVuSans",
      "font_size": 10
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 440.8, "urx": 522, "ury": 455.2 },
      "content": "What the stream weighs",
      "font": "DejaVuSans",
      "font_size": 12
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 394.8, "urx": 522, "ury": 430.8 },
      "content": "Drawn by glyph index, the three lines above cost 541 bytes of page stream; drawn through one-byte codes, 347 bytes, which is 194 less. Both figures are measured by the program that drew this page, not written in by hand.",
      "font": "DejaVuSans",
      "font_size": 10
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 360.4, "urx": 522, "ury": 374.8 },
      "content": "What the single byte 32 buys",
      "font": "DejaVuSans",
      "font_size": 12
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 334, "urx": 522, "ury": 348.4 },
      "content": "Words a reader can push apart.",
      "font": "coded",
      "font_size": 12
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 311.6, "urx": 522, "ury": 326 },
      "content": "Words a reader can push apart.",
      "font": "coded",
      "font_size": 12,
      "word_spacing": 6
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 245.6, "urx": 522, "ury": 293.6 },
      "content": "The two lines above hold the same characters. The second is drawn with word spacing set, which moves the pen at the single byte 32 and at no other code. Under glyph indices no code is a single byte 32, so the operator has nothing to reach and the words never move; the space of this encoding sits at 32, so they do.",
      "font": "DejaVuSans",
      "font_size": 10
    },
    {
      "type": "flow",
      "rect": { "llx": 72, "lly": 182.4, "urx": 522, "ury": 225.6 },
      "content": "One byte addresses 255 characters at a time, so a page of several alphabets is still reached by glyph index. No ligature and no small capital is drawn through an encoding either: those are glyphs no character stands for, and a code stands for a character. A file that claims archival conformance states the Windows encoding as the one its codes are read against, which this one does.",
      "font": "DejaVuSans",
      "font_size": 9
    }
  ]
}