iText 5

FontFactory

FontFactory Public class

Description

If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files to this static class first and then create fonts in your code using one of the static getFont-method without having to enter a path as parameter.

Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.FontFactory[[FontFactory]] end

Members

Properties

Public Static properties

Type

Name

Methods

bool

DefaultEmbedding

get

string

DefaultEncoding

get

FontFactoryImp

FontImp

get, set

ICollection<string>

RegisteredFamilies


Gets a set of registered font families.

get

ICollection<string>

RegisteredFonts


Gets a set of registered fontnames.

get

Methods

Public Static methods

Returns

Name

bool

Contains

(string fontname)
Checks whether the given font is contained within the object

Font

GetFont

(...)
Constructs a Font-object.

bool

IsRegistered

(string fontname)
Checks if a certain font is registered.

void

Register

(...)

int

RegisterDirectories

()

int

RegisterDirectory

(...)

void

RegisterFamily

(string familyName, string fullName, string path)

Details

Summary

If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files to this static class first and then create fonts in your code using one of the static getFont-method without having to enter a path as parameter.

Methods

GetFont [1/14]

Source code

public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

bool

embedded

true if the font is to be embedded in the PDF

float

size

the size of this font

int

style

the style of this font

BaseColor

color

the BaseColor of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [2/14]

Source code

public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color, bool cached)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

bool

embedded

true if the font is to be embedded in the PDF

float

size

the size of this font

int

style

the style of this font

BaseColor

color

the BaseColor of this font

bool

cached

true if the font comes from the cache or is added to the cache if new, false if the font is always created new

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [3/14]

Source code

public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

bool

embedded

true if the font is to be embedded in the PDF

float

size

the size of this font

int

style

the style of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [4/14]

Source code

public static Font GetFont(string fontname, string encoding, bool embedded, float size)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

bool

embedded

true if the font is to be embedded in the PDF

float

size

the size of this font

Summary

Constructs a Font-object.

Returns
GetFont [5/14]

Source code

public static Font GetFont(string fontname, string encoding, bool embedded)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

bool

embedded

true if the font is to be embedded in the PDF

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [6/14]

Source code

public static Font GetFont(string fontname, string encoding, float size, int style, BaseColor color)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

float

size

the size of this font

int

style

the style of this font

BaseColor

color

the BaseColor of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [7/14]

Source code

public static Font GetFont(string fontname, string encoding, float size, int style)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

float

size

the size of this font

int

style

the style of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [8/14]

Source code

public static Font GetFont(string fontname, string encoding, float size)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

float

size

the size of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [9/14]

Source code

public static Font GetFont(string fontname, string encoding)

Arguments

Type

Name

Description

string

fontname

the name of the font

string

encoding

the encoding of the font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [10/14]

Source code

public static Font GetFont(string fontname, float size, int style, BaseColor color)

Arguments

Type

Name

Description

string

fontname

the name of the font

float

size

the size of this font

int

style

the style of this font

BaseColor

color

the BaseColor of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [11/14]

Source code

public static Font GetFont(string fontname, float size, BaseColor color)

Arguments

Type

Name

Description

string

fontname

the name of the font

float

size

the size of this font

BaseColor

color

the BaseColor of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [12/14]

Source code

public static Font GetFont(string fontname, float size, int style)

Arguments

Type

Name

Description

string

fontname

the name of the font

float

size

the size of this font

int

style

the style of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [13/14]

Source code

public static Font GetFont(string fontname, float size)

Arguments

Type

Name

Description

string

fontname

the name of the font

float

size

the size of this font

Summary

Constructs a Font-object.

Returns

a Font object

GetFont [14/14]

Source code

public static Font GetFont(string fontname)

Arguments

Type

Name

Description

string

fontname

the name of the font

Summary

Constructs a Font-object.

Returns

a Font object

RegisterFamily

Source code

public static void RegisterFamily(string familyName, string fullName, string path)

Arguments

Type

Name

Description

string

familyName

string

fullName

string

path

Register [1/3]

Source code

public static void Register(Properties attributes)

Arguments

Type

Name

Description

Properties

attributes

Register [2/3]

Source code

public static void Register(string path)

Arguments

Type

Name

Description

string

path

the path to a ttf- or ttc-file

Summary

Register a ttf- or a ttc-file.

Register [3/3]

Source code

public static void Register(string path, string alias)

Arguments

Type

Name

Description

string

path

the path to a ttf- or ttc-file

string

alias

the alias you want to use for the font

Summary

Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file.

RegisterDirectory [1/2]

Source code

public static int RegisterDirectory(string dir)

Arguments

Type

Name

Description

string

dir

RegisterDirectory [2/2]

Source code

public static int RegisterDirectory(string dir, bool scanSubdirectories)

Arguments

Type

Name

Description

string

dir

bool

scanSubdirectories

RegisterDirectories

Source code

public static int RegisterDirectories()

Contains

Source code

public static bool Contains(string fontname)

Arguments

Type

Name

Description

string

fontname

the name of the font

Summary

Checks whether the given font is contained within the object

Returns

true if font is contained within the object

IsRegistered

Source code

public static bool IsRegistered(string fontname)

Arguments

Type

Name

Description

string

fontname

the name of the font that has to be checked

Summary

Checks if a certain font is registered.

Returns

true if the font is found

Properties

RegisteredFonts

public static ICollection<string> RegisteredFonts { get; }

Summary

Gets a set of registered fontnames.

Value

a set of registered fontnames

RegisteredFamilies

public static ICollection<string> RegisteredFamilies { get; }

Summary

Gets a set of registered font families.

Value

a set of registered font families

DefaultEncoding

public static string DefaultEncoding { get; }

DefaultEmbedding

public static bool DefaultEmbedding { get; }

FontImp

public static FontFactoryImp FontImp { get; set; }

Generated with ModularDoc