Package com.itextpdf.io.font
Class FontNames
java.lang.Object
com.itextpdf.io.font.FontNames
Stores naming and style information read from a font program.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the font's embedding permissions allow embedding.Gets the CID font name.String[][]Gets the font family names.String[][]Get extra family names.Gets the PostScript font name.Gets font stretch in css notation (font-stretch property).intGets the normalized font weight.String[][]Gets the full font names.protected intGets the rawhead.macStylebit field.String[][]getNames(int id) Extracts the names of the font in all the languages available.getStyle()Gets the font style name.Gets the first available subfamily name.booleanisBold()Checks the bold bit in the Macintosh style flags.booleanChecks the condensed bit in the Macintosh style flags.booleanChecks the extended bit in the Macintosh style flags.booleanisItalic()Checks the italic bit in the Macintosh style flags.booleanChecks the outline bit in the Macintosh style flags.booleanisShadow()Checks the shadow bit in the Macintosh style flags.booleanChecks the underline bit in the Macintosh style flags.protected voidsetAllNames(Map<Integer, List<String[]>> allNames) Sets the names grouped by OpenType name ID.protected voidsetAllowEmbedding(boolean allowEmbedding) Sets the embedding permission.protected voidsetCidFontName(String cidFontName) Sets the CID font name.protected voidsetFamilyName(String familyName) Sets a single font family name.protected voidsetFamilyName(String[][] familyName) Sets the font family-name records.protected voidsetFamilyName2(String[][] familyName2) Set extra family name used for better fonts match.protected voidsetFontName(String psFontName) Sets the PostScript font name.protected voidsetFontStretch(String fontStretch) Sets font stretch in css notation (font-stretch property).protected voidsetFontWeight(int weight) Sets font weight.protected voidsetFullName(String fullName) Sets a single full name.protected voidsetFullName(String[][] fullName) Sets the full-name records.protected voidsetMacStyle(int macStyle) Sets Open Type head.macStyle.protected voidSets the font style string.protected voidsetSubfamily(String subfamily) Sets a single subfamily name.protected voidsetSubfamily(String[][] subfamily) Sets the subfamily name records.toString()
-
Field Details
-
allNames
Name records grouped by OpenType name ID.
-
-
Constructor Details
-
FontNames
public FontNames()
-
-
Method Details
-
getNames
Extracts the names of the font in all the languages available.- Parameters:
-
id- the name id to retrieve in OpenType notation - Returns:
-
not empty
String[][]if any names exists, otherwisenull.
-
getFullName
Gets the full font names.- Returns:
-
name records for OpenType name ID 4, or
nullwhen unavailable
-
getFontName
Gets the PostScript font name.- Returns:
-
PostScript name, or
nullwhen unavailable
-
getCidFontName
Gets the CID font name.- Returns:
-
OpenType name ID 20 value, or
nullwhen unavailable
-
getFamilyName
Gets the font family names.- Returns:
-
name records for OpenType name ID 16 or 1, or
nullwhen unavailable
-
getFamilyName2
Get extra family names.- Returns:
-
name records for OpenType name ID 1, or
nullwhen unavailable
-
getStyle
Gets the font style name.- Returns:
- style string
-
getSubfamily
Gets the first available subfamily name.- Returns:
- name ID 2 or 17 value, or an empty string when unavailable
-
getFontWeight
public int getFontWeight()Gets the normalized font weight.- Returns:
-
weight in the range represented by
FontWeights
-
setFontWeight
protected void setFontWeight(int weight) Sets font weight.- Parameters:
-
weight- integer form 100 to 900. SeeFontWeights.
-
getFontStretch
Gets font stretch in css notation (font-stretch property).- Returns:
-
One of
FontStretchesvalues.
-
setFontStretch
Sets font stretch in css notation (font-stretch property).- Parameters:
-
fontStretch-FontStretches.
-
allowEmbedding
public boolean allowEmbedding()Checks whether the font's embedding permissions allow embedding.- Returns:
-
truewhen embedding is permitted
-
isBold
public boolean isBold()Checks the bold bit in the Macintosh style flags.- Returns:
-
truewhen bold is declared
-
isItalic
public boolean isItalic()Checks the italic bit in the Macintosh style flags.- Returns:
-
truewhen italic is declared
-
isUnderline
public boolean isUnderline()Checks the underline bit in the Macintosh style flags.- Returns:
-
truewhen underline is declared
-
isOutline
public boolean isOutline()Checks the outline bit in the Macintosh style flags.- Returns:
-
truewhen outline is declared
-
isShadow
public boolean isShadow()Checks the shadow bit in the Macintosh style flags.- Returns:
-
truewhen shadow is declared
-
isCondensed
public boolean isCondensed()Checks the condensed bit in the Macintosh style flags.- Returns:
-
truewhen condensed is declared
-
isExtended
public boolean isExtended()Checks the extended bit in the Macintosh style flags.- Returns:
-
truewhen extended is declared
-
setAllNames
Sets the names grouped by OpenType name ID.- Parameters:
-
allNames- names grouped by OpenType name ID
-
setFullName
Sets the full-name records.- Parameters:
-
fullName- records in platform, encoding, language, name order
-
setFullName
Sets a single full name.- Parameters:
-
fullName- font full name
-
setFontName
Sets the PostScript font name.- Parameters:
-
psFontName- PostScript name
-
setCidFontName
Sets the CID font name.- Parameters:
-
cidFontName- OpenType name ID 20 value
-
setFamilyName
Sets the font family-name records.- Parameters:
-
familyName- records in platform, encoding, language, name order
-
setFamilyName2
Set extra family name used for better fonts match.- Parameters:
-
familyName2- family name to set.
-
setFamilyName
Sets a single font family name.- Parameters:
-
familyName- preferred family name
-
setStyle
Sets the font style string.- Parameters:
-
style- style name
-
setSubfamily
Sets a single subfamily name.- Parameters:
-
subfamily- style subfamily name
-
setSubfamily
Sets the subfamily name records.- Parameters:
-
subfamily- records in platform, encoding, language, name order
-
setMacStyle
protected void setMacStyle(int macStyle) Sets Open Type head.macStyle.- Parameters:
-
macStyle- macStyle flag
-
getMacStyle
protected int getMacStyle()Gets the rawhead.macStylebit field.- Returns:
- Macintosh style flags
-
setAllowEmbedding
protected void setAllowEmbedding(boolean allowEmbedding) Sets the embedding permission.- Parameters:
-
allowEmbedding-truewhen embedding is permitted
-
toString
-