Adding a localized name table ↩
- Introduction
- Name record values
- Adding name records with the Font Info sheet
- Adding name records with a script
Introduction
OpenTypeAn extension to the TrueType sfnt
font format that allows for either TrueType or Postscript outlines to be used.
OpenType fonts can include layout tables for advanced typographic features, color font formats, and variations. The format is developed jointly by Microsoft and Adobe. fonts consist of several tables. The name
table is where textual information about the font – such as font names, copyright notice, description, sample strings etc. – is stored. The font maker can supply this kind of information in multiple languages, so that for example German users are presented with texts in German, French users with texts in French, etc.
Name records
Translations of any name
table attribute can be added using name records.
In UFO fonts, name records are stored as dictionaries with the following format:
key | value type | description |
---|---|---|
name ID |
non-negative integer | The name ID. |
platform ID |
non-negative integer | The platform ID. |
encoding ID |
non-negative integer | The encoding ID. |
language ID |
non-negative integer | The language ID. |
string |
string | The string value for the record. |
Records should have a unique combination of
nameID
,platformID
,encodingID
andlanguageID
. In cases where a duplicate is found, the last occurrence of thenameID
,platformID
,encodingID
andlanguageID
combination is taken as the value.
Name record values
This section gives an overview of the possible values for name, platform, encoding and language IDs.
Name ID
Name IDs identify specific kinds of data stored in the OpenType name
table.
The following table maps each name ID to its corresponding UFO info.plist
attribute, where the default value can be found.
NID | description | UFO3 info attribute |
---|---|---|
0 | Copyright notice | copyright |
1 | Font Family name | styleMapFamily |
2 | Font Subfamily name | styleMapStyle |
3 | Unique font identifier | openTypeNameUniqueID |
4 | Full font name | created automatically |
5 | Version string | openTypeNameVersion |
6 | PostScript name | postscriptFontName |
7 | Trademark | trademark |
8 | Manufacturer Name | openTypeNameManufacturer |
9 | Designer | openTypeNameDesigner |
10 | Description | openTypeNameDescription |
11 | Vendor URL | openTypeNameManufacturerURL |
12 | Designer URL | openTypeNameDesignerURL |
13 | License Description | openTypeNameLicense |
14 | License URL | openTypeNameLicenseURL |
15 | Reserved | — |
16 | Typographic Family name | openTypeNamePreferredFamilyName |
17 | Typographic Subfamily name | openTypeNamePreferredSubfamilyName |
18 | Compatible full name | openTypeNameCompatibleFullName |
19 | Sample text | openTypeNameSampleText |
20 | PostScript unique name | postscriptFontName |
21 | WWS Family Name | openTypeNameWWSFamilyName |
22 | WWS Subfamily Name | openTypeNameWWSSubfamilyName |
23 | Light Background Palette | not available in UFO3 |
24 | Dark Background Palette | not available in UFO3 |
25 | Variations PostScript Name Prefix | not available in UFO3 |
Platform ID
Platform IDs identify the platform to which the name records applies.
PID | description |
---|---|
0 | Unicode |
1 | Macintosh |
2 | ISO (deprecated) |
3 | Windows |
4 | Custom |
Encoding ID
Encoding IDs are platform-specific: the meaning of each value depends on the current platform ID.
These are the recommended values for Mac and Windows platforms:
EID | description |
---|---|
0 | Mac (Roman) |
1 | Windows (Unicode) |
Language ID
Language IDs identify the language in which a particular string is written.
The list of languages IDs is extensive, and depends on the platform ID. Please see the OpenType specification for all supported languages and their IDs:
Adding name records with the Font Info sheet
Name records can be edited manually in the OpenType section of the Font Info sheet.
Click on the plus button to add a new name record, and fill in the cells with the required data.
Use the minus button to remove the selected name records.
Adding name records with a script
The following example shows how to add name records with a script.
nameRecords = [
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 1, # Mac
"encodingID" : 0, # Roman
"languageID" : 1, # French
"string" : 'Voix ambiguë d’un cœur qui au zéphyr préfère les jattes de kiwi ',
},
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 3, # Windows
"encodingID" : 1, # Unicode
"languageID" : 1, # French
"string" : 'Voix ambiguë d’un cœur qui au zéphyr préfère les jattes de kiwi ',
},
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 1, # Mac
"encodingID" : 0, # Roman
"languageID" : 2, # German
"string" : 'Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.',
},
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 3, # Windows
"encodingID" : 1, # Unicode
"languageID" : 2, # German
"string" : 'Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.',
},
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 1, # Mac
"encodingID" : 0, # Roman
"languageID" : 6, # Spanish
"string" : 'Benjamín pidió una bebida de kiwi y fresa; Noé, sin vergüenza, la más exquisita champaña del menú.',
},
{
"nameID" : 19, # openTypeNameSampleText
"platformID" : 3, # Windows
"encodingID" : 1, # Unicode
"languageID" : 6, # Spanish
"string" : 'Benjamín pidió una bebida de kiwi y fresa; Noé, sin vergüenza, la más exquisita champaña del menú.',
},
]
f = CurrentFont()
f.info.openTypeNameRecords = nameRecords