Font Class Documentation
class FontNamespace:com::datalogics::PDFL
Detailed Description
Represents a font.Defines the typeface, size, style (bold, italic), Unicode values, and other details. The Font class represents a font installed on the system.
Uses types
Constructor & Destructor Documentation
Font
Font(String fontName)Parameters
fontName: String
Find a font with the specified name, and construct a Font object from it. Otherwise, it makes a font with the default encoding (MacRomanEncoding on Macs, WinAnsiEncoding elsewhere, or for symbol fonts, their own custom encoding). There is not a way to specify another encoding for the font.
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
Font
Font(String fontName, java.util.EnumSet< FontCreateFlags > createFlags)Parameters
fontName: Stringthe name of the font to create
createFlags: java.util.EnumSet< FontCreateFlags >flags specifying embedding and other options for the use of a font in the document
Find a font with the specified name, and construct a Font object from it. Otherwise, it makes a font with the default encoding (MacRomanEncoding on Macs, WinAnsiEncoding elsewhere, or for symbol fonts, their own custom encoding). There is not a way to specify another encoding for the font.
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
Font
Font(String fontName, java.util.EnumSet< FontCreateFlags > createFlags, WritingMode wrMode)Parameters
fontName: Stringthe name of the font to create
createFlags: java.util.EnumSet< FontCreateFlags >flags specifying embedding and other options for the use of a font in the document
wrMode: WritingModedetermines whether text will be printed horizontally or vertically
Find a font with the specified name, and construct a Font object from it. Otherwise, it makes a font with the default encoding (MacRomanEncoding on Macs, WinAnsiEncoding elsewhere, or for symbol fonts, their own custom encoding). There is not a way to specify another encoding for the font.
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H or Identity-V encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
Member Function Documentation
delete
synchronized void delete(Boolean disposing)Parameters
disposing: Boolean
Returns:
synchronized voiddelete
synchronized void delete()Returns:
synchronized voidDestructor.
embedNow
void embedNow(Document doc)Parameters
doc: Documentthe Document the Font is embedded into
Returns:
voidEmbeds the Font.
finalize
void finalize()Returns:
voidDestructor.
findIndexOfFirstUnrepresentableChar
long findIndexOfFirstUnrepresentableChar(String text)Parameters
text: Stringthe text to check
Returns:
longThe index of the first character that cannot be represented in this font.
Find the index of the first character that cannot be represented in this font. This will return the index of the first character in the string for which the font has no glyph. If all characters can be represented (i.e. if IsTextRepresentable() would return true), this will return the length of the string.
getAscent
double getAscent()Returns:
doubleThe Ascent value of the font in glyph space units.
the Ascent value from the font descriptor. This is the maximum height above the baseline reached by glyphs in this font, excluding the height of glyphs for accented characters.
getAvgWidth
double getAvgWidth()Returns:
doubleThe AvgWidth value of the font in glyph space units, or 0 if not defined.
the AvgWidth value from the font descriptor. This is the average width of glyphs in the font, or 0 if the value is not defined in the font descriptor.
getBBox
Rect getBBox()Returns:
RectThe Bounding Box rectangle of the font.
getCapHeight
double getCapHeight()Returns:
doubleThe CapHeight value of the font in glyph space units, or 0 if not defined.
the CapHeight value from the font descriptor. This is the vertical coordinate of the top of flat capital letters, measured from the baseline, or 0 if the value is not defined in the font descriptor.
getCidFontType
String getCidFontType()Returns:
StringgetDescent
double getDescent()Returns:
doubleThe descent value of the font. \xrefitem pdelayer_apis "PDE Layer" "PDE Layer" PDSysFont PDSysFontGetAttrs \xrefitem pdelayer_apis "PDE Layer" "PDE Layer" PDEFont PDEFontGetAttrs \xrefitem pdlayer_apis "PD Layer" "PD Layer" PDFont PDFontGetMetrics
the Descent value from the font descriptor. This is the maximum depth below the baseline reached by glyphs in this font. The value is a negative number.
getEmbedded
boolean getEmbedded()Returns:
booleanTests that Font is embedded in the document it was created for returns true if the font is embedded and returns false if it is not
getEncoding
String getEncoding()Returns:
StringThe encoding of the font, eg:
WinAnsiEncoding
MacRomanEncoding
Return the encoding of the font.
getEncodingInfo
EncodingInfo getEncodingInfo()Returns:
EncodingInfoGet the populated CEncoding object.
getFlags
java.util.EnumSet< FontFlags > getFlags()Returns:
java.util.EnumSet< FontFlags >Get the font flags for a font.
getFontList
static java.util.List< Font > getFontList()Returns:
java.util.List< Font >The list of available fonts.
Get a list of available fonts.
getFullName
String getFullName()Returns:
StringThe Full Name of the font. Note: This method only returns a meaningful result for TrueType-based technology fonts.
Get the Full Name of the font.
getItalicAngle
double getItalicAngle()Returns:
doubleThe ItalicAngle value of the font in degrees.
the ItalicAngle value from the font descriptor. This is the angle, expressed in degrees counterclockwise from the vertical, of the dominant vertical strokes of the font, defined in the font descriptor.
getLeading
double getLeading()Returns:
doubleThe leading value of the font, or 0 if not present.
the Leading value from the font descriptor. This is the spacing between baselines of consecutive lines of text, or 0 if the value is not defined in the font descriptor.
getMaxWidth
double getMaxWidth()Returns:
doubleThe MaxWidth value of the font in glyph space units, or 0 if not present.
the MaxWidth value from the font descriptor. This is the maximum glyph width present in the font, or 0 if the value is not defined in the font descriptor.
getMissingWidth
double getMissingWidth()Returns:
doubleThe MissingWidth value of the font in glyph space units, or 0 if not present.
the MissingWidth value from the font descriptor. This is the width given to characters that do not have corresponding glyphs defined in the font, or 0 if the value is not defined in the font descriptor.
getName
String getName()Returns:
StringThe name of the font.
Get the name of the font.
getPDFDict
PDFDict getPDFDict()Returns:
PDFDictRetrieve the PDFDict representation of this object
getStemH
double getStemH()Returns:
doubleThe StemH value of the font in glyph space units, or 0 if not present.
the StemH value from the font descriptor. This is the vertical thickness of the dominant horizontal stems of the font's glyphs, or 0 if the value is not defined in the font descriptor.
getStemV
double getStemV()Returns:
doubleThe StemV value of the font in glyph space units, or 0 if not present.
the StemV value from the font descriptor. This is the horizontal thickness of the dominant vertical stems of the font's glyphs, or 0 if the value is not defined in the font descriptor.
getType
String getType()Returns:
StringThe type of the font.
Type0
Type1
MMType1
TrueType
Get the type of the font.
getWritingMode
WritingMode getWritingMode()Returns:
WritingModeThe WritingMode of the font.
Get the writing mode of the font. The writing mode of the fontwhether it will place glyphs horizontally or vertically. Text written with this font will run in the direction of the writing mode.
getXHeight
double getXHeight()Returns:
doubleThe XHeight value of the font in glyph space units, or 0 if not present.
the XHeight value from the font descriptor. This is the vertical coordinate of the top of flat nonascending lowercase letters in fonts that have Latin characters, as measured from the baseline, or 0 if the value is not defined in the font descriptor.
isFromDoc
boolean isFromDoc()Returns:
booleanisTextRepresentable
boolean isTextRepresentable(String text)Parameters
text: Stringthe text to check
Returns:
booleanIs this text representable in this font?
measureTextWidth
double measureTextWidth(String text, double fontSize)Parameters
text: Stringthe Text to be measured
fontSize: doublethe Font size to be used
Returns:
doubleMeasures the width of the specified text in points, using the Font at the specified size.