Skip to main content
Skip table of contents

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
TypeNameMethods
boolDefaultEmbeddingget, set
stringDefaultEncodingget, 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
ReturnsName
FontGetFont(...)
Constructs a Font-object.
boolIsRegistered(string fontname)
Checks if a certain font is registered.
voidRegister(...)
Register a ttf- or a ttc-file.
intRegisterDirectories()
intRegisterDirectory(...)
voidRegisterFamily(string familyName, string fullName, string path)
Protected methods
ReturnsName
BaseFontGetBaseFont(string fontname, string encoding, bool embedded, bool cached)
boolSaveCopyOfRegularFont(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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
boolembeddedtrue if the font is to be embedded in the PDF
floatsizethe size of this font
intstylethe style of this font
BaseColorcolorthe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
boolembeddedtrue if the font is to be embedded in the PDF
floatsizethe size of this font
intstylethe style of this font
BaseColorcolorthe BaseColor of this font
boolcachedtrue 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
TypeNameDescription
stringfontname
stringencoding
boolembedded
boolcached
GetFont [3/14]

Source code

public virtual Font GetFont(string fontname, string encoding, bool embedded, float size, int style)
Arguments
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
boolembeddedtrue if the font is to be embedded in the PDF
floatsizethe size of this font
intstylethe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
boolembeddedtrue if the font is to be embedded in the PDF
floatsizethe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
boolembeddedtrue 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
floatsizethe size of this font
intstylethe style of this font
BaseColorcolorthe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
floatsizethe size of this font
intstylethe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe encoding of the font
floatsizethe 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
TypeNameDescription
stringfontnamethe name of the font
stringencodingthe 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
TypeNameDescription
stringfontnamethe name of the font
floatsizethe size of this font
intstylethe style of this font
BaseColorcolorthe 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
TypeNameDescription
stringfontnamethe name of the font
floatsizethe size of this font
BaseColorcolorthe 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
TypeNameDescription
stringfontnamethe name of the font
floatsizethe size of this font
intstylethe 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
TypeNameDescription
stringfontnamethe name of the font
floatsizethe 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
TypeNameDescription
stringfontnamethe 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
TypeNameDescription
stringfamilyName
stringfullName
stringpath
Register [1/2]

Source code

public virtual void Register(string path)
Arguments
TypeNameDescription
stringpaththe 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
TypeNameDescription
stringpaththe path to a ttf- or ttc-file
stringaliasthe 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
TypeNameDescription
stringregularFontName
stringpath
RegisterDirectory [1/2]

Source code

public virtual int RegisterDirectory(string dir)
Arguments
TypeNameDescription
stringdir
RegisterDirectory [2/2]

Source code

public virtual int RegisterDirectory(string dir, bool scanSubdirectories)
Arguments
TypeNameDescription
stringdir
boolscanSubdirectories
RegisterDirectories

Source code

public virtual int RegisterDirectories()
IsRegistered

Source code

public virtual bool IsRegistered(string fontname)
Arguments
TypeNameDescription
stringfontnamethe 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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.