Class FontFactoryImp
- Namespace
- iTextSharp.text
- Assembly
- iTextSharp.LGPLv2.Core.dll
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. It's a registry class and defined as a singleton to prevent misusing it.
public sealed class FontFactoryImp
- Inheritance
-
FontFactoryImp
- Inherited Members
Properties
DefaultEmbedding
Gets or set DefaultEmbedding
public bool DefaultEmbedding { get; set; }
Property Value
DefaultEncoding
Gets or set DefaultEncoding
public string DefaultEncoding { get; set; }
Property Value
Instance
Gets an Instance of FontFactoryImp
public static FontFactoryImp Instance { get; }
Property Value
RegisteredFamilies
Gets a set of registered font families.
public static ICollection<string> RegisteredFamilies { get; }
Property Value
- ICollection<string>
a set of registered font families
RegisteredFonts
Gets a set of registered fontnames.
public static ICollection<string> RegisteredFonts { get; }
Property Value
- ICollection<string>
a set of registered fontnames
Methods
GetFont(string)
Constructs a Font-object.
public Font GetFont(string fontname)
Parameters
fontname
stringthe name of the font
Returns
- Font
a Font object
GetFont(string, float)
Constructs a Font-object.
public Font GetFont(string fontname, float size)
Parameters
Returns
- Font
a Font object
GetFont(string, float, int)
Constructs a Font-object.
public Font GetFont(string fontname, float size, int style)
Parameters
fontname
stringthe name of the font
size
floatthe size of this font
style
intthe style of this font
Returns
- Font
a Font object
GetFont(string, float, int, BaseColor)
Constructs a Font-object.
public Font GetFont(string fontname, float size, int style, BaseColor color)
Parameters
fontname
stringthe name of the font
size
floatthe size of this font
style
intthe style of this font
color
BaseColorthe Color of this font
Returns
- Font
a Font object
GetFont(string, float, BaseColor)
Constructs a Font-object.
public Font GetFont(string fontname, float size, BaseColor color)
Parameters
fontname
stringthe name of the font
size
floatthe size of this font
color
BaseColorthe Color of this font
Returns
- Font
a Font object
GetFont(string, string)
Constructs a Font-object.
public Font GetFont(string fontname, string encoding)
Parameters
Returns
- Font
a Font object
GetFont(string, string, bool)
Constructs a Font-object.
public static Font GetFont(string fontname, string encoding, bool embedded)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
embedded
booltrue if the font is to be embedded in the PDF
Returns
- Font
a Font object
GetFont(string, string, bool, float)
Constructs a Font-object.
public static Font GetFont(string fontname, string encoding, bool embedded, float size)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
embedded
booltrue if the font is to be embedded in the PDF
size
floatthe size of this font
Returns
GetFont(string, string, bool, float, int)
Constructs a Font-object.
public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
embedded
booltrue if the font is to be embedded in the PDF
size
floatthe size of this font
style
intthe style of this font
Returns
- Font
a Font object
GetFont(string, string, bool, float, int, BaseColor)
Constructs a Font-object.
public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
embedded
booltrue if the font is to be embedded in the PDF
size
floatthe size of this font
style
intthe style of this font
color
BaseColorthe Color of this font
Returns
- Font
a Font object
GetFont(string, string, bool, float, int, BaseColor, bool)
Constructs a Font-object.
public static Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color, bool cached)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
embedded
booltrue if the font is to be embedded in the PDF
size
floatthe size of this font
style
intthe style of this font
color
BaseColorthe Color of this font
cached
booltrue if the font comes from the cache or is added to the cache if new, false if the font is always created new
Returns
- Font
a Font object
GetFont(string, string, float)
Constructs a Font-object.
public Font GetFont(string fontname, string encoding, float size)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
size
floatthe size of this font
Returns
- Font
a Font object
GetFont(string, string, float, int)
Constructs a Font-object.
public Font GetFont(string fontname, string encoding, float size, int style)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
size
floatthe size of this font
style
intthe style of this font
Returns
- Font
a Font object
GetFont(string, string, float, int, BaseColor)
Constructs a Font-object.
public Font GetFont(string fontname, string encoding, float size, int style, BaseColor color)
Parameters
fontname
stringthe name of the font
encoding
stringthe encoding of the font
size
floatthe size of this font
style
intthe style of this font
color
BaseColorthe Color of this font
Returns
- Font
a Font object
GetFont(Properties)
Constructs a Font-object.
public Font GetFont(Properties attributes)
Parameters
attributes
Propertiesthe attributes of a Font object
Returns
- Font
a Font object
IsRegistered(string)
Checks if a certain font is registered.
public static bool IsRegistered(string fontname)
Parameters
fontname
stringthe name of the font that has to be checked
Returns
- bool
true if the font is found
Register(string)
Register a ttf- or a ttc-file.
public void Register(string path)
Parameters
path
stringthe path to a ttf- or ttc-file
Register(string, string)
Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file.
public void Register(string path, string alias)
Parameters
Register(Properties)
public void Register(Properties attributes)
Parameters
attributes
Properties
RegisterDirectories()
Register fonts in some probable directories. It usually works in Windows, Linux and Solaris.
public int RegisterDirectories()
Returns
- int
the number of fonts registered
RegisterDirectory(string)
Register all the fonts in a directory.
public int RegisterDirectory(string dir)
Parameters
dir
stringthe directory
Returns
- int
the number of fonts registered
RegisterDirectory(string, bool)
Register all the fonts in a directory and possibly its subdirectories. @since 2.1.2
public int RegisterDirectory(string dir, bool scanSubdirectories)
Parameters
Returns
- int
the number of fonts registered
RegisterFamily(string, string, string)
Register a font by giving explicitly the font family and name.
public static void RegisterFamily(string familyName, string fullName, string path)