What are legal characters in font names?
What characters should I expect when "consuming" font names, and which ones should I avoid when "generating" font names? Are there differences between different operating systems, traditional desktop apps, mobile or web apps (-> CSS) and different font formats like OpenType, TrueType, WOFF, PostScript, SVG, etc.
source to share
Almost all of the formats you list are OpenType versions :
- modern TrueType refers to an OpenType font with TrueType glyph outlines
- WOFF is simply to wrap "SFNT" structured fonts, which are basically just OpenType fonts these days, allowing additional compression for each table.
- Modern PostScript refers to an OpenType font with a CFF block that describes outlines using an inline font format with Type2 charstrings (which are not actually PostScript. Only Type 1 fonts were PostScript fonts, but when OpenType completely removed Adobe Retired Type 1 by moving their whole font directory instead of OpenType with CFF blocks)
- SVG can refer to two different things in the context of fonts: "svg fonts", which is a dead technology , and a new variant of OpenType fonts with SVG outlines .
So this is really a question of "what naming format OpenType allows" and "within that format which is most widely supported." Fortunately, most of this information is from the OpenType Naming Specification .
The important part is that you don't define the last name of "one", you define it multiple times for different audiences. Take a look at the Name IDs section for the naming table and you will see several fields dedicated to placing the font name, only for different contexts:
- Font family name, free line form. This is used in "regular applications" to tell you what font you are looking for.
- The name of the font subfamily, for example. "italic", "oblique", etc.
- The unique identifier for this font. Sensible IDs include some combination of IDs 1 and 2 plus some "when this file was released" information, but you can get free form as well.
- "Full font name". Typically just the names ids 1 and 2 separated by a space, but you can deviate from that if you like.
- Font version string with rules for how it should look
- The title of the postscript. This one is special and you should read what it is used for. The name should in no way match the real name of the font. This is a good form to make sure it does.
As a real world example, let's take a look at the name strings for Palatino Linotype:
- "Palatino Linotype"
- "Usual"
- "Palatino Linotype Regular April 1998"
- "Palatino Linotype"
- "Version 5.00"
- "PalatinoLinotype-Roman"
In terms of platform differences, not every platform needs all of these lines in order for a font to be installed or used. Click this SO question for more information on this. For example, for websites, the 1st name identifier is technically sufficient, since the "role" that the font plays is determined by the rule @font-face
we give it, but for desktop applications 2 through 5 do. And of course, for PS devices, ID 6 is critical, which is why operating systems usually don't recognize a font as "correct" without it.
source to share
According to W3 . Only ISO-10646 characters can be used in a valid font name.
According to Adobe , PostScript fonts must not contain spaces and can only use characters from the standard ASCII character set. The name must be no more than 29 characters.
It is recommended that you separate the font family name and style definition with a hyphen and use uppercase and lowercase characters for optimization purposes, as some parsers work best when they can look for the first uppercase character followed by a lowercase character.
The standard names used in the Macintosh font menus come from the FOND resource associated with the Type 1 font type. FOND names can be up to 31 characters long and may contain spaces, but anything over 30 characters does not work due to a known bug.
On Windows, font menu names are specified in the Font Metrics (PFM) printer and must be 31 characters or less; the same recommendation to limit to 30 characters as in the Macintosh exists.
The Adobes Naming Convention is considered an industry-wide standard.
If you're looking for a test, take a look at this regression test: http://search.cpan.org/~mhosken/Font-TTF-1.05/lib/Font/TTF/Font.pm
source to share