New to Telerik Document ProcessingStart a free 30-day trial

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:

C#
public static class FontsRepository

Inheritance: objectFontsRepository

Methods

Clears all registered custom fonts from the repository, resetting it to default state.

C#
public static void ClearRegisteredFonts()

Clears all standard font fallbacks from the repository.

C#
public static void ClearStandardFontFallbacks()

Registers a font with the specified font family, style, weight, and data for use in PDF documents.

C#
public static void RegisterFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, byte[] data)
Parameters:fontFamilyFontFamily

The font family to register.

fontStyleFontStyle

The font style (normal, italic, etc.).

fontWeightFontWeight

The 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.

C#
public static void ReplaceStandardFont(StandardFontNames name, byte[] data)
Parameters:nameStandardFontNames

The name of the standard font to be replaced.

databyte[]

The binary font data to use as replacement.

Exceptions:

NotSupportedFontException

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.

Sets a fallback font to be used when a standard font cannot be loaded or used.

C#
public static void SetStandardFontFallback(StandardFontNames name, FontBase fallback)
Parameters:nameStandardFontNames

The name of the standard font for which to set a fallback.

fallbackFontBase

The fallback font to use in place of the standard font.

Exceptions:

ArgumentNullException

Thrown when fallback is null.

NotSupportedFontException

Thrown when an invalid standard font name is passed.

Tries to create a new font object based on the given font properties.

C#
public static bool TryCreateFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, out FontBase font)
Parameters:fontFamilyFontFamily

The font family to create.

fontStyleFontStyle

The font style (normal, italic, etc.).

fontWeightFontWeight

The font weight (normal, bold, etc.).

fontFontBase

When this method returns, contains the created font object if successful, or null if creation failed.

Returns:

bool

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.

C#
public static bool TryCreateFont(FontFamily fontFamily, out FontBase font)
Parameters:fontFamilyFontFamily

The font family to create.

fontFontBase

When this method returns, contains the created font object if successful, or null if creation failed.

Returns:

bool

True if the font was created successfully; otherwise, false.

Properties

Gets the Courier font object.

C#
public static FontBase Courier { get; }
Property Value:

The Courier font instance.

Gets the Courier Bold font object.

C#
public static FontBase CourierBold { get; }
Property Value:

The Courier Bold font instance.

Gets the Courier Bold Oblique font object.

C#
public static FontBase CourierBoldOblique { get; }
Property Value:

The Courier Bold Oblique font instance.

Gets the Courier Oblique font object.

C#
public static FontBase CourierOblique { get; }
Property Value:

The Courier Oblique font instance.

Gets the Helvetica font object.

C#
public static FontBase Helvetica { get; }
Property Value:

The Helvetica font instance.

Gets the Helvetica Bold font object.

C#
public static FontBase HelveticaBold { get; }
Property Value:

The Helvetica Bold font instance.

Gets the Helvetica Bold Oblique font object.

C#
public static FontBase HelveticaBoldOblique { get; }
Property Value:

The Helvetica Bold Oblique font instance.

Gets the Helvetica Oblique font object.

C#
public static FontBase HelveticaOblique { get; }
Property Value:

The Helvetica Oblique font instance.

Gets the Symbol font object.

C#
public static FontBase Symbol { get; }
Property Value:

The Symbol font instance.

Gets the Times Bold font object.

C#
public static FontBase TimesBold { get; }
Property Value:

The Times Bold font instance.

Gets the Times Bold Italic font object.

C#
public static FontBase TimesBoldItalic { get; }
Property Value:

The Times Bold Italic font instance.

Gets the Times Italic font object.

C#
public static FontBase TimesItalic { get; }
Property Value:

The Times Italic font instance.

Gets the Times Roman font object.

C#
public static FontBase TimesRoman { get; }
Property Value:

The Times Roman font instance.

Gets the ZapfDingbats font object.

C#
public static FontBase ZapfDingbats { get; }
Property Value:

The ZapfDingbats font instance.