public class TtfNameTable extends TtfTableBase
Represents "name" table of the TTF Font file.
Modifier and Type | Method and Description |
---|---|
void |
addMultiLanguageNames(MultiLanguageString mlNames,
PlatformId platformId,
int platformSpecificId,
NameId nameId)
Extracts all multilingual strings from passed
mlNames object and
creates correspondent NameRecord structure for every string extracted using passed
parameters platformId , platformSpecificId and nameId . |
void |
addName(NameId nameId,
PlatformId platformId,
int platformSpecificId,
int languageId,
String name)
Adds entry into the table.
|
void |
deleteRecords(PlatformId platformId,
int platformSpecificId)
Deletes all the records related to platform specified
|
void |
deleteRecords(PlatformId platformId,
int platformSpecificId,
NameId nameId)
Deletes all the records related to passed parameters
|
void |
deleteRecords(PlatformId platformId,
int platformSpecificId,
NameId nameId,
int languageId)
Deletes record(s) related to parameters specified
|
void |
deleteRecordsByNameId(NameId nameId) |
NameRecord[] |
getAllNameRecords()
Returns all
NameRecord structures from table. |
MultiLanguageString |
getMultiLanguageNameById(NameId nameId)
returns a name by nameId
|
MultiLanguageString |
getMultiLanguageNameById(NameId nameId,
PlatformId platformId)
Returns a name by nameId using platform identifier passed.
|
MultiLanguageString |
getMultiLanguageNameById(NameId nameId,
PlatformId platformId,
int platformSpecificId)
Returns a name as object of type
MultiLanguageString . |
String |
getNameById(NameId nameId)
Returns a name by nameId if found, null otherwise.
|
NameRecord[] |
getNameRecordsByNameId(NameId nameId)
Returns all
NameRecord structures which NameId field is equal
to passed nameId value. |
static String |
getTag()
Gets table tag.
|
void |
updateName(PlatformId platformId,
int platformSpecificId,
NameId nameId,
int languageId,
String newName)
Updates name in record(s) which related to specified platform (combination of platformId and platformSpecificId),
category (nameId) and language (languageId).
|
void |
updateNamesByNameId(NameId nameId,
String newName)
Selects all records which related to logical string category, specified by parameter nameId and
updates name field (string data) in these records.
|
getLength, getOffset, getTtfTables
public static String getTag()
Gets table tag.
public void addName(NameId nameId, PlatformId platformId, int platformSpecificId, int languageId, String name)
Adds entry into the table. String data category to add is specified by name
parameter.
nameId
- Name identifier, logical string category, specified by NameId
enumeration.platformId
- Platform identifier.platformSpecificId
- Platform-specific encoding identifier. Please, use value from one of
such enumerations - UnicodePlatformSpecificId
, MacPlatformSpecificId
,
MSPlatformSpecificId
. What enumeration to use is defined by context (platformId
parameter).languageId
- Language identifier. Please, use value from MSLanguageId
or
MacLanguageId
enumerations depend from context, defined by platformId
parameter.name
- Actual string data.public void deleteRecordsByNameId(NameId nameId)
public void deleteRecords(PlatformId platformId, int platformSpecificId, NameId nameId)
Deletes all the records related to passed parameters
platformId
- Platform identifierplatformSpecificId
- Platform-specific encoding identifiernameId
- Name identifier, logical string category, specified by NameId
enumerationpublic void deleteRecords(PlatformId platformId, int platformSpecificId)
Deletes all the records related to platform specified
platformId
- Platform identifierplatformSpecificId
- Platform-specific encoding identifierpublic void deleteRecords(PlatformId platformId, int platformSpecificId, NameId nameId, int languageId)
Deletes record(s) related to parameters specified
platformId
- Platform identifierplatformSpecificId
- Platform-specific encoding identifiernameId
- Name identifier, logical string category, specified by NameId
enumerationlanguageId
- Language identifierpublic void updateName(PlatformId platformId, int platformSpecificId, NameId nameId, int languageId, String newName)
Updates name in record(s) which related to specified platform (combination of platformId and platformSpecificId), category (nameId) and language (languageId).
platformId
- Platform identifierplatformSpecificId
- Platform-specific encoding identifiernameId
- Name identifier, logical string category, specified by NameId
enumerationlanguageId
- Language identifiernewName
- New name or new string datapublic void updateNamesByNameId(NameId nameId, String newName)
Selects all records which related to logical string category, specified by parameter nameId and updates name field (string data) in these records. Fields related to platform (platformID, Platform-specific encoding ID) and language (Language ID) are not affected by this method. Only name string data is replaced with a new name. Use this method with caution, cause it will replace original names for all platforms and languages, related to nameId. It can make a conflicts for cases when original names had different values, cause replace operation changes all these values with new single one.And this new value may have a logical inconsistency with some platforms and languages. This method is useful for cases when original name has single representation for all platforms and languages, for example, when name string data is in English language.
nameId
- Name identifier, logical string category, specified by NameId
enumerationnewName
- New name or new string datapublic void addMultiLanguageNames(MultiLanguageString mlNames, PlatformId platformId, int platformSpecificId, NameId nameId)
Extracts all multilingual strings from passed mlNames
object and
creates correspondent NameRecord structure for every string extracted using passed
parameters platformId
, platformSpecificId
and nameId
.
Value for field languageID is extracted from mlNames
object.
New just created record is added into table.
If record which coincides with just created by fields platformID, platformSpecificID, nameID and, langugeId
will be found, then new created record will not be added and only string data will be updated for existing record.
mlNames
- Multilingual stringplatformId
- Platform identifierplatformSpecificId
- Platform-specific encoding identifiernameId
- Name identifier, logical string category, specified by NameId
enumerationpublic String getNameById(NameId nameId)
Returns a name by nameId if found, null otherwise.
nameId
- name identifierpublic MultiLanguageString getMultiLanguageNameById(NameId nameId)
returns a name by nameId
nameId
- name Id.public MultiLanguageString getMultiLanguageNameById(NameId nameId, PlatformId platformId)
Returns a name by nameId using platform identifier passed.
nameId
- Name Id.platformId
- Platform Id.public MultiLanguageString getMultiLanguageNameById(NameId nameId, PlatformId platformId, int platformSpecificId)
Returns a name as object of type MultiLanguageString
.
Method collects all NameRecord structures which coincide
with passed parameters nameId, platformId and platformSpecificId and then builds resultant object
based on this structures list.
nameId
- Name Id.platformId
- Platform Id.platformSpecificId
- Platform specific Id.public NameRecord[] getAllNameRecords()
Returns all NameRecord
structures from table.
NameRecord
structures from table.public NameRecord[] getNameRecordsByNameId(NameId nameId)
Returns all NameRecord
structures which NameId field is equal
to passed nameId
value. If no records found, empty array will be returned.
nameId
- name identifierNameRecord
structures