Font Class Documentation

class Font : SystemIDisposable

Namespace:Datalogics::PDFL

Inherits from:
SystemIDisposable

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(string fontName)

Parameters

fontName: string

the name of the font to find and create

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, FontCreateFlags createFlags)

Parameters

fontName: string

the name of the font to create

createFlags: 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, FontCreateFlags createFlags, WritingMode wrMode)

Parameters

fontName: string

the name of the font to create

createFlags: 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).

Property Documentation

Ascent

double Ascent[get]

AvgWidth

double AvgWidth[get]

BBox

Rect BBox[get]

CapHeight

double CapHeight[get]

CidFontType

string CidFontType[get]

Descent

double Descent[get]

Embedded

bool Embedded[get]

Encoding

string Encoding[get]

EncodingInfo

EncodingInfo EncodingInfo[get]

Flags

FontFlags Flags[get]

FontList

static System.Collections.Generic.IList< Font > FontList[get]

FullName

string FullName[get]

ItalicAngle

double ItalicAngle[get]

Leading

double Leading[get]

MaxWidth

double MaxWidth[get]

MissingWidth

double MissingWidth[get]

Name

string Name[get]

PDFDict

PDFDict PDFDict[get]

StemH

double StemH[get]

StemV

double StemV[get]

Type

string Type[get]

WritingMode

WritingMode WritingMode[get]

XHeight

double XHeight[get]

Member Function Documentation

Dispose

void Dispose()

Returns:

void

EmbedNow

void EmbedNow(Document doc)

Parameters

doc: Document

the Document the Font is embedded into

Returns:

void

Embeds the Font.

FindIndexOfFirstUnrepresentableChar

uint FindIndexOfFirstUnrepresentableChar(string text)

Parameters

text: string

the text to check

Returns:

uint

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.

IsFromDoc

bool IsFromDoc()

Returns:

bool

true if the font was loaded from a document, false if it was created from a system font.

Determine whether this font was obtained from an existing document rather than the system.

IsTextRepresentable

bool IsTextRepresentable(string text)

Parameters

text: string

the text to check

Returns:

bool

true if all characters in the text have corresponding glyphs in this font.

Is this text representable in this font?

MeasureTextWidth

double MeasureTextWidth(string text, double fontSize)

Parameters

text: string

the Text to be measured

fontSize: double

the Font size to be used

Returns:

double

The width of the text in points.

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