Search code examples
fontstruetypeopentypewoff

What are legal characters in Font names?


What characters do I have to expect when "consuming" font names and which ones should I avoid when "producing" font names? Are there differences between different operating systems, traditional desktop applications, mobile or web apps (->CSS) and different font formats like OpenType, TrueType, WOFF, PostScript, SVG etc.?


Solution

  • Almost all the formats you list are versions of OpenType:

    • modern TrueType refers to an OpenType font with TrueType glyph outlines
    • WOFF simply wrap "SFNT" structured fonts, which these days is basically just OpenType fonts, allowing for optional per-table compression.
    • modern PostScript refers to an OpenType font with a CFF block, which describes outlines using an embedded font format with Type2 charstrings (which aren't actually PostScript. Only "Type 1" fonts were PostScript fonts, but when OpenType took off Adobe retired Type 1 entirely, moving their entire font catalogue over to OpenType with CFF blocks instead)
    • SVG in the context of fonts can refer to two different things: "svg fonts", which is a dead technology, and a new variant of OpenType fonts with SVG outlines.

    So it's really a question of "which naming format does OpenType allow", and "within that, which format is widest supported". Thankfully, the OpenType naming table specification has most of that information.

    The important part is that you're not defining "one" family name, you define it several times, for different audiences. Have a look at the "Name IDs" section for the name table, and you'll see several fields all intended to house the font name, just for different contexts:

    1. Font family name, free string form. This is used in "normal applications" to tell you what font you're looking at.
    2. Font subfamily name, e.g. "italic", "oblique", etc.
    3. A unique identifier for this font. Sensible ids involve some combination of ids 1 and 2 plus some "when this file was released" information, but you can also go free form.
    4. The "full font name". Typically, just name ids 1 and 2, separated by a space, but you can deviate from this if you want.
    5. The font version string, with rules on what it should look like
    6. The postscript name. This one is special, and you should read up on what it's used for. The name in no way has to match the real font name. It's good form to make sure it does, though.

    As a real world example, let's look at the name strings for Palatino Linotype:

    1. "Palatino Linotype"
    2. "Regular"
    3. "Palatino Linotype Regular April 1998"
    4. "Palatino Linotype"
    5. "Version 5.00"
    6. "PalatinoLinotype-Roman"

    In terms of platform differences, not every platform needs all these strings for the font to be installable, or usable. Hit up this SO question for more information on that. For webfonts, for instance, Name ID 1 is technically sufficient since the "role" the font plays is wholy determined by the @font-face rule we give it, but for desktop applications IDs 2 through 5 matter a lot. And of course for postscript devices, ID 6 is critical, so Operating Systems tend to not recognise a font as "proper" without it.