A font whose letters you draw yourself

Describe your own letters with lines and shapes, then set text in them like any other font.

Summary

Sometimes you need a sign that exists in no font on the market: a company logo, a workshop pictogram, a tally mark. Drawn stroke by stroke and given a place in a font of your own making, it behaves from then on like a letter: you pick a size, you type the character, and the drawing appears at that scale, in the middle of an ordinary sentence.

Technically

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

type3_fonts declares /Subtype /Type3 fonts whose every letter is a drawing the request describes itself, with the same shapes an item draws on a page: a path, a rectangle, a line, a block of text. Those drawings are the font's /CharProcs, content streams of their own. The letters live in a space of their own, and the /FontMatrix says what one unit of that space is worth in text space. Codes are handed out in order of character, so the same letters in another order build the same font.

Request schema

  • type3_fonts — array, optional, empty by default.
  • type3_fonts[].name — string, required. The name items set text in this font by.
  • type3_fonts[].matrix — array of six numbers, required. What the glyph space is worth in text space; the usual thousandth of an em is [0.001, 0, 0, 0.001, 0, 0].
  • type3_fonts[].box — object, required. The area of the glyph space that is kept: llx, lly, urx, ury, numbers, all required. Nothing outside it is drawn.
  • type3_fonts[].glyphs — array, required. The letters the font draws.
  • glyphs[].character — character, required. The character this glyph draws.
  • glyphs[].width — number, required. How far the pen moves after it, in glyph space.
  • glyphs[].box — object, optional. The shape's own bounds. A letter stating its box takes the colour of the text around it, and the colours its shapes state are set aside. A letter stating none paints itself, in its shapes' colours.
  • glyphs[].items — array, required. The shapes that draw it, in drawing order: path, rect, line. A block of text inside a letter is refused.

Codes fit in one byte. A letter reaches the colour spaces, gradients, graphics states and layers the request declares.

A whole request that creates a PDF

{
  "type3_fonts": [
    {
      "name": "blocks",
      "matrix": [0.001, 0, 0, 0.001, 0, 0],
      "box": { "llx": 0, "lly": 0, "urx": 700, "ury": 700 },
      "glyphs": [
        {
          "character": "A",
          "width": 700,
          "box": { "llx": 0, "lly": 0, "urx": 600, "ury": 600 },
          "items": [
            {
              "type": "rect",
              "rect": { "llx": 50, "lly": 0, "urx": 550, "ury": 600 },
              "fill": [0]
            }
          ]
        }
      ]
    }
  ],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 60, "lly": 700, "urx": 300, "ury": 760 },
      "content": ["AAA"],
      "font": "blocks",
      "font_size": 36
    }
  ]
}

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 backup font for the rarer signs Fonts whose letters cost one byte

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