iText 5

FontFactoryImp

FontFactoryImp Public class

Description

If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files to this class first and then create fonts in your code using one of the 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.FontFactoryImp[[FontFactoryImp]] iTextSharp.text.IFontProvider[[IFontProvider]] class iTextSharp.text.IFontProvider interfaceStyle; end iTextSharp.text.IFontProvider --> iTextSharp.text.FontFactoryImp

Members

Properties

Public properties

Type

Name

Methods

bool

DefaultEmbedding

get, set

string

DefaultEncoding

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 methods

Returns

Name

Font

GetFont

(...)
Constructs a Font-object.

bool

IsRegistered

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

void

Register

(...)
Register a ttf- or a ttc-file.

int

RegisterDirectories

()

int

RegisterDirectory

(...)

void

RegisterFamily

(string familyName, string fullName, string path)

Protected methods

Returns

Name

BaseFont

GetBaseFont

(string fontname, string encoding, bool embedded, bool cached)

bool

SaveCopyOfRegularFont

(string regularFontName, 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 class first and then create fonts in your code using one of the getFont method without having to enter a path as parameter.

Inheritance

Constructors

FontFactoryImp

Source code

public FontFactoryImp()

Summary

Creates new FontFactory

Methods

GetFont [1/14]

Source code

public virtual 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 virtual 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

GetBaseFont

Source code

protected virtual BaseFont GetBaseFont(string fontname, string encoding, bool embedded, bool cached)

Arguments

Type

Name

Description

string

fontname

string

encoding

bool

embedded

bool

cached

GetFont [3/14]

Source code

public virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual void RegisterFamily(string familyName, string fullName, string path)

Arguments

Type

Name

Description

string

familyName

string

fullName

string

path

Register [1/2]

Source code

public virtual 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 [2/2]

Source code

public virtual 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.

SaveCopyOfRegularFont

Source code

protected bool SaveCopyOfRegularFont(string regularFontName, string path)

Arguments

Type

Name

Description

string

regularFontName

string

path

RegisterDirectory [1/2]

Source code

public virtual int RegisterDirectory(string dir)

Arguments

Type

Name

Description

string

dir

RegisterDirectory [2/2]

Source code

public virtual int RegisterDirectory(string dir, bool scanSubdirectories)

Arguments

Type

Name

Description

string

dir

bool

scanSubdirectories

RegisterDirectories

Source code

public virtual int RegisterDirectories()

IsRegistered

Source code

public virtual 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 virtual ICollection<string> RegisteredFonts { get; }

Summary

Gets a set of registered fontnames.

Value

a set of registered fontnames

RegisteredFamilies

public virtual ICollection<string> RegisteredFamilies { get; }

Summary

Gets a set of registered font families.

Value

a set of registered font families

DefaultEncoding

public virtual string DefaultEncoding { get; set; }

DefaultEmbedding

public virtual bool DefaultEmbedding { get; set; }

Generated with ModularDoc