A Backup Font for the Rarer Signs

Chain several fonts together: each character is drawn by the first one in the list that has a shape for it.

See It in a Real PDF

A Font behind the Font

One line of statuses set twice: in a company font alone, where the characters it has no glyph for come out as empty boxes, then with a second font behind it that draws them.

Open the PDF The Whole Example

Summary

No font carries every sign in the world. A handsome text font may well know nothing of the Greek alphabet, of an ideogram, or of a rarer currency symbol, and what it cannot draw comes out as an empty box. Line up a second font behind it, and a third behind that, and the reader sees a complete text instead.

Technically

Written at the top level of a request, under "font_chains"

font_chains declares a font made of several others, under its own name, and no font of its own: a run is split character by character, and each character is drawn by the first font of the chain that carries a shape for it, so what reaches the file is the fonts already declared. Each font in the chain stays usable as it is elsewhere. Links are looked for among the embedded fonts, the client's, the font store's, and among the fonts the request declares itself: the fourteen normalised fonts, the Type 1 programs, the drawn letters.

Request Schema

  • font_chains — array, optional, empty by default.
  • font_chains[].name — string, required. The name items set text in the chain by.
  • font_chains[].faces — array of strings, required. The fonts it is made of, in the order a character is offered to them. A chain naming fewer than two fonts, those of its ranges counted, is refused.
  • font_chains[].ranges — array, optional, empty by default. Each entry, {"from": "0", "to": "9", "font": "figures"}, hands the characters from from to to, both included, to its font before the faces, whether a face has a glyph for them or not; a character that font has no glyph for goes on to the faces. Ranges are tried in the order given; one whose to comes before its from is refused.
  • font_chains[].ranges[].scale and rise — numbers, optional. scale is the factor of the size the range's font draws its characters at, rise the fraction of the size it raises them by, below the baseline where negative; both are kept to the thousandth. Absent, the characters are drawn at the size of the text, on the baseline.

A link names an embedded font, a client font, one from the font store, or a font the request declares: standard_fonts, type1_fonts, type3_fonts. The fonts a request declares are loaded before the chains, so a chain can lean on them.

A Whole Request That Creates a PDF

{
  "standard_fonts": [
    { "name": "sans", "face": "helvetica" },
    { "name": "signs", "face": "symbol" }
  ],
  "font_chains": [
    { "name": "text_and_signs", "faces": ["sans", "signs"] }
  ],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 60, "lly": 740, "urx": 535, "ury": 765 },
      "content": ["Angle α = 30 degrees"],
      "font": "text_and_signs",
      "font_size": 14
    }
  ]
}

The line that sends it, in three languages

The fonts

Carrying a Font inside the Document The Older Type 1 Font Programs The Fourteen Fonts All Reading Software Owns The Typographic Niceties of a Font A Font Whose Letters You Draw Yourself Fonts Whose Letters Cost One Byte Fonts Whose Signs Come Out in Colour Fonts the Document Names without Carrying A Font Whose Makers Forbid Carrying It Fonts Carried Whole

Where to Go Next

Every JSON key of a request, in one page The other forty-one settings of a request

See the Prices See the Examples