Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 866
Thomas W Avatar asked Aug 09 '15 05:08

Thomas W


2 Answers

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

like image 88
davidcondrey Avatar answered Oct 02 '22 18:10

davidcondrey


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.

like image 37
Mike 'Pomax' Kamermans Avatar answered Oct 02 '22 17:10

Mike 'Pomax' Kamermans