Font Class Documentation

classFont

Namespace: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.

Constructor & Destructor Documentation

Font

Font(StringfontName)

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(StringfontName, java.util.EnumSet< FontCreateFlags >createFlags)

Parameters

fontName: String

the 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(StringfontName, java.util.EnumSet< FontCreateFlags >createFlags, WritingModewrMode)

Parameters

fontName: String

the 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: WritingMode

determines 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

DisposeChildren

voidDisposeChildren()

Returns:

void

[static initializer]

static void[static initializer]()

delete

synchronized voiddelete(Booleandisposing)

Parameters

disposing: Boolean

Returns:

synchronized void

delete

synchronized voiddelete()

Returns:

synchronized void

Destructor.

embedNow

voidembedNow(Documentdoc)

Parameters

doc: Document

the Document the Font is embedded into

Returns:

void

Embeds the Font.

finalize

voidfinalize()

Returns:

void

Destructor.

findIndexOfFirstUnrepresentableChar

longfindIndexOfFirstUnrepresentableChar(Stringtext)

Parameters

text: String

the text to check

Returns:

The 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

doublegetAscent()

Returns:

The 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

doublegetAvgWidth()

Returns:

The 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

RectgetBBox()

Returns:

Rect

The Bounding Box rectangle of the font.

getCapHeight

doublegetCapHeight()

Returns:

The 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

StringgetCidFontType()

Returns:

String

getDescent

doublegetDescent()

Returns:

The 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

booleangetEmbedded()

Returns:

boolean

Tests 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

StringgetEncoding()

Returns:

The encoding of the font, eg: WinAnsiEncoding MacRomanEncoding

Return the encoding of the font.

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:

The list of available fonts.

Get a list of available fonts.

getFullName

StringgetFullName()

Returns:

The 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

doublegetItalicAngle()

Returns:

The 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

doublegetLeading()

Returns:

The 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

doublegetMaxWidth()

Returns:

The 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

doublegetMissingWidth()

Returns:

The 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

StringgetName()

Returns:

The name of the font.

Get the name of the font.

getPDFDict

PDFDictgetPDFDict()

Returns:

PDFDict

Retrieve the PDFDict representation of this object

getStemH

doublegetStemH()

Returns:

The 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

doublegetStemV()

Returns:

The 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

StringgetType()

Returns:

The type of the font. Type0 Type1 MMType1 TrueType

Get the type of the font.

getWritingMode

WritingModegetWritingMode()

Returns:

The 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

doublegetXHeight()

Returns:

The 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

booleanisFromDoc()

Returns:

boolean

isTextRepresentable

booleanisTextRepresentable(Stringtext)

Parameters

text: String

the text to check

Returns:

boolean

Is this text representable in this font?

measureTextWidth

doublemeasureTextWidth(Stringtext, doublefontSize)

Parameters

text: String

the Text to be measured

fontSize: double

the Font size to be used

Returns:

double

Measures the width of the specified text in points, using the Font at the specified size.