Class FontFactory
- 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 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.
public static class FontFactory
- Inheritance
-
FontFactory
- Inherited Members
Fields
COURIER
This is a possible value of a base 14 type 1 font
public const string COURIER = "Courier"
Field Value
COURIER_BOLD
This is a possible value of a base 14 type 1 font
public const string COURIER_BOLD = "Courier-Bold"
Field Value
COURIER_BOLDOBLIQUE
This is a possible value of a base 14 type 1 font
public const string COURIER_BOLDOBLIQUE = "Courier-BoldOblique"
Field Value
COURIER_OBLIQUE
This is a possible value of a base 14 type 1 font
public const string COURIER_OBLIQUE = "Courier-Oblique"
Field Value
HELVETICA
This is a possible value of a base 14 type 1 font
public const string HELVETICA = "Helvetica"
Field Value
HELVETICA_BOLD
This is a possible value of a base 14 type 1 font
public const string HELVETICA_BOLD = "Helvetica-Bold"
Field Value
HELVETICA_BOLDOBLIQUE
This is a possible value of a base 14 type 1 font
public const string HELVETICA_BOLDOBLIQUE = "Helvetica-BoldOblique"
Field Value
HELVETICA_OBLIQUE
This is a possible value of a base 14 type 1 font
public const string HELVETICA_OBLIQUE = "Helvetica-Oblique"
Field Value
SYMBOL
This is a possible value of a base 14 type 1 font
public const string SYMBOL = "Symbol"
Field Value
TIMES
This is a possible value of a base 14 type 1 font
public const string TIMES = "Times"
Field Value
TIMES_BOLD
This is a possible value of a base 14 type 1 font
public const string TIMES_BOLD = "Times-Bold"
Field Value
TIMES_BOLDITALIC
This is a possible value of a base 14 type 1 font
public const string TIMES_BOLDITALIC = "Times-BoldItalic"
Field Value
TIMES_ITALIC
This is a possible value of a base 14 type 1 font
public const string TIMES_ITALIC = "Times-Italic"
Field Value
TIMES_ROMAN
This is a possible value of a base 14 type 1 font
public const string TIMES_ROMAN = "Times-Roman"
Field Value
ZAPFDINGBATS
This is a possible value of a base 14 type 1 font
public const string ZAPFDINGBATS = "ZapfDingbats"
Field Value
Properties
DefaultEmbedding
This is the default value of the embedded variable.
public static bool DefaultEmbedding { get; }
Property Value
DefaultEncoding
This is the default encoding to use.
public static string DefaultEncoding { get; }
Property Value
FontImp
public static FontFactoryImp FontImp { get; set; }
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
Contains(string)
Checks whether the given font is contained within the object
public static bool Contains(string fontname)
Parameters
fontname
stringthe name of the font
Returns
- bool
true if font is contained within the object
GetFont(string)
Constructs a Font-object.
public static Font GetFont(string fontname)
Parameters
fontname
stringthe name of the font
Returns
- Font
a Font object
GetFont(string, float)
Constructs a Font-object.
public static Font GetFont(string fontname, float size)
Parameters
Returns
- Font
a Font object
GetFont(string, float, int)
Constructs a Font-object.
public static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static void Register(string path, string alias)
Parameters
Register(Properties)
public static void Register(Properties attributes)
Parameters
attributes
Properties
RegisterDirectories()
Register fonts in some probable directories. It usually works in Windows, Linux and Solaris.
public static int RegisterDirectories()
Returns
- int
the number of fonts registered
RegisterDirectory(string)
Register all the fonts in a directory.
public static 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 static 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)