The Typographic Niceties of a Font

Turn on ligatures, small capitals, oldstyle figures or kerning for a font, under a new name of its own.

See It in a Real PDF

A Page Set in a Font from 1990

A font in Adobe's oldest format, the kind a print shop bought twenty years ago and almost nothing reads any more, cut down to the letters the page draws. Every figure the page states about it was read out of the font itself.

Open the PDF The Whole Example

Also shown in: A Font behind the Font · What a Font Knows about Its Own Letters

Summary

A good font hides refinements that books have used for centuries. Some pairs of letters are drawn in one stroke so they do not bump into each other. Capitals can be small, the height of lowercase letters, for a quiet heading. Figures can rise and fall like letters instead of standing all in a row. And the space between two letters can close up where the font asks for it. Each of these sits in the font file already, switched off until you ask for it.

Technically

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

font_variants builds one more font from another, with the OpenType features turned on — ligatures, small capitals, oldstyle figures, kerning — and makes it available under its own name. The original font stays as it is: both live side by side in the same request. The four features turn on separately, which is what lets the same text be shown with and without. The base font is an embedded font, a client font or one from the font store.

Request Schema

  • font_variants — array, optional, empty by default.
  • font_variants[].name — string, required. The variant's name.
  • font_variants[].from — string, required. The name of the original font: an embedded font (fonts), a client font, or one from the font store.
  • font_variants[].ligatures — boolean, optional, false by default. Joins the pairs of letters the font draws as one shape.
  • font_variants[].small_capitals — boolean, optional, false by default. Draws lowercase letters as small capitals.
  • font_variants[].oldstyle_figures — boolean, optional, false by default. Draws figures rising and falling like lowercase letters.
  • font_variants[].kerning — boolean, optional, false by default. Closes up each pair by what the font says about it.
  • font_variants[].features — array of strings, optional, empty by default. The typographic features turned on beside the four above, each by the four-letter tag the font registers it under: "tnum" for figures of one width, "zero" for a slashed zero, "ss01" for a stylistic set, "locl" for the forms of the language chosen. "mark" places each combining mark (an accent typed as a character of its own) over or under the letter before it, and "mkmk" places it over the mark before it, at the positions the font gives; "curs" joins the letters of a joined script, Arabic or a handwriting face, end to end, each starting exactly where the one before it ends; "cpsp" spaces capitals out. A tag is four printable letters, padded with spaces; a feature the font does not offer changes nothing.
  • font_variants[].without_features — array of strings, optional, empty by default. The features turned off, each by its tag: one this variant or the font it is made from turned on, "kern" for kerning.
  • font_variants[].language_system — object, optional. The script and the language the font reads its features for: script, required, a tag such as "latn", "cyrl" or "arab"; language, optional, a tag such as "SRB " for Serbian or "TRK " for Turkish. Absent reads the features for the default language of each script, and a script or a language the font does not name falls back to its default.
  • font_variants[].stand_ins — boolean, optional, false by default. Draws a character no font of the chain has a glyph for as a character standing in for it that the chain can draw: a space for a no-break space, a hyphen-minus for a minus sign. The stand-in is shown inside a span whose /ActualText is the character asked for, so text copied out of the page, or read aloud, is that character and not the stand-in, and a document claiming accessibility may draw one.
  • A variant also takes stand_in_font, the name of a font declared before it that draws the stand-ins, which turns stand_ins on; and glyph_name_suffixes, such as ["alt", "sc", ""], the suffixes a character no font of the chain maps is looked for under, by glyph name.

What the variant delivers rests on the tables the font carries: a font with no ligature table draws the same text as its base. A name another font already goes by is refused.

A Whole Request That Creates a PDF

One name below stands for a font file: put the encoded file in its place, or send the file itself beside the description, as a supplied part of the same call. One page carries a real font already encoded, and its request posts as it stands.

{
  "fonts": [{ "name": "body", "data": "PASTE_THE_FONT_FILE_BASE64_HERE" }],
  "font_variants": [
    { "name": "body_small_capitals", "from": "body", "small_capitals": true }
  ],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 60, "lly": 740, "urx": 535, "ury": 765 },
      "content": ["Chapter one"],
      "font": "body_small_capitals",
      "font_size": 16
    }
  ]
}

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 A Font Whose Letters You Draw Yourself A Backup Font for the Rarer Signs 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