FontsRepository
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
Methods
Clears all registered custom fonts from the repository, resetting it to default state.
public static void ClearRegisteredFonts()
Clears all standard font fallbacks from the repository.
public static void ClearStandardFontFallbacks()
Registers a font with the specified font family, style, weight, and data for use in PDF documents.
public static void RegisterFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, byte[] data)
The font family to register.
fontStyleFontStyleThe font style (normal, italic, etc.).
fontWeightFontWeightThe font weight (normal, bold, etc.).
databyte[]The binary font data.
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.
public static void ReplaceStandardFont(StandardFontNames name, byte[] data)
The name of the standard font to be replaced.
databyte[]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.
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.
Sets a fallback font to be used when a standard font cannot be loaded or used.
public static void SetStandardFontFallback(StandardFontNames name, FontBase fallback)
The name of the standard font for which to set a fallback.
fallbackFontBaseThe 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.
Tries to create a new font object based on the given font properties.
public static bool TryCreateFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, out FontBase font)
The font family to create.
fontStyleFontStyleThe font style (normal, italic, etc.).
fontWeightFontWeightThe font weight (normal, bold, etc.).
fontFontBaseWhen 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.
Tries to create a new font object with normal style and weight based on the given font family.
public static bool TryCreateFont(FontFamily fontFamily, out FontBase font)
The font family to create.
fontFontBaseWhen 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.
Properties
Gets the Courier font object.
public static FontBase Courier { get; }
The Courier font instance.
Gets the Courier Bold font object.
public static FontBase CourierBold { get; }
The Courier Bold font instance.
Gets the Courier Bold Oblique font object.
public static FontBase CourierBoldOblique { get; }
The Courier Bold Oblique font instance.
Gets the Courier Oblique font object.
public static FontBase CourierOblique { get; }
The Courier Oblique font instance.
Gets the Helvetica font object.
public static FontBase Helvetica { get; }
The Helvetica font instance.
Gets the Helvetica Bold font object.
public static FontBase HelveticaBold { get; }
The Helvetica Bold font instance.
Gets the Helvetica Bold Oblique font object.
public static FontBase HelveticaBoldOblique { get; }
The Helvetica Bold Oblique font instance.
Gets the Helvetica Oblique font object.
public static FontBase HelveticaOblique { get; }
The Helvetica Oblique font instance.
Gets the Symbol font object.
public static FontBase Symbol { get; }
The Symbol font instance.
Gets the Times Bold font object.
public static FontBase TimesBold { get; }
The Times Bold font instance.
Gets the Times Bold Italic font object.
public static FontBase TimesBoldItalic { get; }
The Times Bold Italic font instance.
Gets the Times Italic font object.
public static FontBase TimesItalic { get; }
The Times Italic font instance.
Gets the Times Roman font object.
public static FontBase TimesRoman { get; }
The Times Roman font instance.
Gets the ZapfDingbats font object.
public static FontBase ZapfDingbats { get; }
The ZapfDingbats font instance.