What are legal characters in Font names?
Asked Answered
S

2

10

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.?

Solfeggio answered 9/8, 2015 at 5:12 Comment(2)
The tags seem to suggest that you're asking in the context of CSS only. If you were asking about a wide range of applications your question could be seen as too broad unless there is some sort of standard around this.Guinea
@Guinea I understand the CSS tag might be misleading. I'm not really asking about CSS, but CSS might have restrictions concerning font names that I don't know of.Solfeggio
F
3

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.

Financier answered 13/8, 2015 at 2:38 Comment(4)
Great answer! In my production environment, I'm still dealing with actual PostScript code (not what's called "PostScript outline" OpenType fonts) where the font name (in OpenType terms ID 6 it seems) apparently needs to follow the syntax for PostScript language Name tokens as described in the PostScript Language Reference Manual (without the slash usually preceding PostScript names).Solfeggio
I am curious to know what context still requires genuine Type1 fonts these days. What do you produce them for?Kaczmarek
As all PostScript consuming programs in question (Ghostscript, Adobe stuff) also support rendering PostScript with any font technology supported by the OS, be it PostScript or not, Type 1 fonts aren't a requirement, but proper PostScript font names are whenever dealing with PostScript. There's two reasons why there are still occasions on which I'm dealing with PostScript: 1) output of or compatibility with legacy software and 2) PostScript is still more straightforward to produce than PDF (and it can easily be converted to PDF). It should be obvious that I'm talking about print production.Solfeggio
It is, hence my interest. Adobe went to great pains to uplift their entire font catalog and PDF production line of applications to be OpenType oriented (OT-CFF, while maintaining some semblance of backward compat.) so I was simply curious what your chain looked like to still "need" the old format.Kaczmarek
C
6

According to W3. Only ISO-10646 characters may be used in a valid font face name.


According to Adobe, PostScript fonts must not contain spaces and may only use characters from the standard ASCII character set. The name should also be no more than 29 characters long.

It is recommended to separate the font family name and the style definition using a hyphen and for optimization purposes to use both upper and lower case characters because some parsers work best when they are able to search for the first uppercase character followed by a lowercase character.

The standard names used in Macintosh font menus come from the name of the FOND resource associated with a Type 1 outline font. FOND resource names are technically allowed to be up to 31 characters, and may contain spaces but anything over 30 characters does not work due to a known bug.

In the Windows environment, font menu names are specified in the Printer Font Metrics (PFM) file and must be no greater than 31 characters; the same recommendation of limiting to 30 characters as in Macintosh exists.

Adobe’s naming convention is considered to be the industry-wide standard.


If your seeking a test have a look at this regression test: http://search.cpan.org/~mhosken/Font-TTF-1.05/lib/Font/TTF/Font.pm

Cuxhaven answered 9/8, 2015 at 5:30 Comment(0)
F
3

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.

Financier answered 13/8, 2015 at 2:38 Comment(4)
Great answer! In my production environment, I'm still dealing with actual PostScript code (not what's called "PostScript outline" OpenType fonts) where the font name (in OpenType terms ID 6 it seems) apparently needs to follow the syntax for PostScript language Name tokens as described in the PostScript Language Reference Manual (without the slash usually preceding PostScript names).Solfeggio
I am curious to know what context still requires genuine Type1 fonts these days. What do you produce them for?Kaczmarek
As all PostScript consuming programs in question (Ghostscript, Adobe stuff) also support rendering PostScript with any font technology supported by the OS, be it PostScript or not, Type 1 fonts aren't a requirement, but proper PostScript font names are whenever dealing with PostScript. There's two reasons why there are still occasions on which I'm dealing with PostScript: 1) output of or compatibility with legacy software and 2) PostScript is still more straightforward to produce than PDF (and it can easily be converted to PDF). It should be obvious that I'm talking about print production.Solfeggio
It is, hence my interest. Adobe went to great pains to uplift their entire font catalog and PDF production line of applications to be OpenType oriented (OT-CFF, while maintaining some semblance of backward compat.) so I was simply curious what your chain looked like to still "need" the old format.Kaczmarek

© 2022 - 2024 — McMap. All rights reserved.