New to Telerik UI for WinForms? Download free 30-day trial

Custom Fonts

RadRichTextEditor is working with the installed fonts on the client machine. Certain scenarios require that a specific document be displayed with a special font which might not be present on the machines on which the application has been deployed. This kind of setup is supported the our Telerik Presentation Framework as well as the RadRichTextEditor control.

Figure 1: Custom Font

WinForms RadRichTextEditor Custom Font

In order to utilize this functionality, one needs to load the font carried with the application and then register it with the editor.

The Ribbon UI initializes prior to the associated RadRichTextEditor and one needs to load and register any in memory fonts before calling the InitializeComponent method of the form

Custom Fonts

public CustomFonts()
    using (Stream stream = System.Reflection.Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("SamplesCS.RichTextEditor.Features.HelveticaLt.ttf"))
        Telerik.WinForms.Documents.Layout.FontManager.RegisterFont(new Telerik.WinControls.RichTextEditor.UI.FontFamily("Helvetica-Light"));

Public Sub New()
    Using stream As Stream = System.Reflection.Assembly.GetAssembly(Me.[GetType]()).GetManifestResourceStream("SamplesVB.HelveticaLt.ttf")
        Telerik.WinForms.Documents.Layout.FontManager.RegisterFont(New Telerik.WinControls.RichTextEditor.UI.FontFamily("Helvetica-Light"))
    End Using
End Sub

See Also

In this article