ClassFontsRepository
Central registry for fonts used by the fixed document model; create standard or embedded fonts and manage font registration.
Definition
Namespace:Telerik.Windows.Documents.Fixed.Model.Fonts
Assembly:Telerik.Windows.Documents.Fixed.dll
Syntax:
public static class FontsRepository
Inheritance: objectFontsRepository
Properties
Courier
Gets the Courier font object.
Declaration
public static FontBase Courier { get; }
Property Value
The Courier font instance.
CourierBold
Gets the Courier Bold font object.
Declaration
public static FontBase CourierBold { get; }
Property Value
The Courier Bold font instance.
CourierBoldOblique
Gets the Courier Bold Oblique font object.
Declaration
public static FontBase CourierBoldOblique { get; }
Property Value
The Courier Bold Oblique font instance.
CourierOblique
Gets the Courier Oblique font object.
Declaration
public static FontBase CourierOblique { get; }
Property Value
The Courier Oblique font instance.
Helvetica
Gets the Helvetica font object.
Declaration
public static FontBase Helvetica { get; }
Property Value
The Helvetica font instance.
HelveticaBold
Gets the Helvetica Bold font object.
Declaration
public static FontBase HelveticaBold { get; }
Property Value
The Helvetica Bold font instance.
HelveticaBoldOblique
Gets the Helvetica Bold Oblique font object.
Declaration
public static FontBase HelveticaBoldOblique { get; }
Property Value
The Helvetica Bold Oblique font instance.
HelveticaOblique
Gets the Helvetica Oblique font object.
Declaration
public static FontBase HelveticaOblique { get; }
Property Value
The Helvetica Oblique font instance.
Symbol
Gets the Symbol font object.
Declaration
public static FontBase Symbol { get; }
Property Value
The Symbol font instance.
TimesBold
Gets the Times Bold font object.
Declaration
public static FontBase TimesBold { get; }
Property Value
The Times Bold font instance.
TimesBoldItalic
Gets the Times Bold Italic font object.
Declaration
public static FontBase TimesBoldItalic { get; }
Property Value
The Times Bold Italic font instance.
TimesItalic
Gets the Times Italic font object.
Declaration
public static FontBase TimesItalic { get; }
Property Value
The Times Italic font instance.
TimesRoman
Gets the Times Roman font object.
Declaration
public static FontBase TimesRoman { get; }
Property Value
The Times Roman font instance.
ZapfDingbats
Gets the ZapfDingbats font object.
Declaration
public static FontBase ZapfDingbats { get; }
Property Value
The ZapfDingbats font instance.
Methods
ClearRegisteredFonts()
Clears all registered custom fonts from the repository, resetting it to default state.
Declaration
public static void ClearRegisteredFonts()
ClearStandardFontFallbacks()
Clears all standard font fallbacks from the repository.
Declaration
public static void ClearStandardFontFallbacks()
RegisterFont(FontFamily, FontStyle, FontWeight, byte[])
Registers a font with the specified font family, style, weight, and data for use in PDF documents.
Declaration
public static void RegisterFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, byte[] data)
Parameters
fontFamily
The font family to register.
fontStyle
The font style (normal, italic, etc.).
fontWeight
The font weight (normal, bold, etc.).
data
byte[]
The binary font data.
ReplaceStandardFont(StandardFontNames, byte[])
Replaces a built-in Standard Font with user-provided Type 1 font data. Use this when the built-in standard font differs from the one you possess (e.g., different vendor/metrics) and you want the PDF to use your exact font.
Declaration
public static void ReplaceStandardFont(StandardFontNames name, byte[] data)
Parameters
name
The name of the standard font to be replaced.
data
byte[]
The binary font data to use as replacement.
Exceptions
Thrown when an invalid font name is passed or the font data is not a valid Type1 font.
Remarks
Not intended for replacing a standard font with a non-standard font. The provided data must represent the same standard Type 1 font corresponding to the specified name.
SetStandardFontFallback(StandardFontNames, FontBase)
Sets a fallback font to be used when a standard font cannot be loaded or used.
Declaration
public static void SetStandardFontFallback(StandardFontNames name, FontBase fallback)
Parameters
name
The name of the standard font for which to set a fallback.
fallback
The fallback font to use in place of the standard font.
Exceptions
Thrown when fallback is null.
Thrown when an invalid standard font name is passed.
TryCreateFont(FontFamily, FontStyle, FontWeight, out FontBase)
Tries to create a new font object based on the given font properties.
Declaration
public static bool TryCreateFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, out FontBase font)
Parameters
fontFamily
The font family to create.
fontStyle
The font style (normal, italic, etc.).
fontWeight
The font weight (normal, bold, etc.).
font
When this method returns, contains the created font object if successful, or null if creation failed.
Returns
True if the font was created successfully; otherwise, false.
TryCreateFont(FontFamily, out FontBase)
Tries to create a new font object with normal style and weight based on the given font family.
Declaration
public static bool TryCreateFont(FontFamily fontFamily, out FontBase font)
Parameters
fontFamily
The font family to create.
font
When this method returns, contains the created font object if successful, or null if creation failed.
Returns
True if the font was created successfully; otherwise, false.