Defines a collection that allows the Reporting Engine to use a private version of an existing font without the requirement to install the font on the host machine. If the font is already installed the installed font is used.
Known issue with the Windows Platform:
If you order the fonts in the PrivateFontCollection first regular then bold the GDI+ measure string size for bold font style is incorrect. This is observed in Windows 8.1 and newer and may lead to unexpected rendering and aligning issues. For more information see: The Connect Item
Known issue with Azure:
The required .NET API for handling private fonts is making GDI calls that are blocked in Azure App Services. If private fonts are required our recommendation is to use Cloud Service plan. The Connect Item
The private fonts are used for all rendering extensions. Still the font rendering on the client computer depends on the viewer configuration and document format specifications:
- PDF: The rendering extension embeds fonts by default. This functionality is controlled by the FontEmbedding device information setting;
- HTML5 Rendering: In order web browser to render HTML with private fonts you have to set up font-face rules. For more information see: W3.org article
- WPF XAML rendering: embeds private fonts by default;
- Silverlight XAML rendering: In addition to add the private fonts as content to the WCF hosting project you have to add the fonts as resources to the Silverlight project with the same relative path;
- For all other document formats the Reporting Engine is using private fonts but in order the document viewer to use them the fonts should be installed on the client computer;
- Windows Forms Report Viewer uses Image rendering to render in EMF+ that don't support private fonts.
As with most types of software, font files are licensed, rather than sold, and licenses that govern the use of fonts vary from vendor to vendor. As a developer it is your responsibility to ensure that you have the required license rights for any font you use as private font, or otherwise redistribute.
<privateFonts> <add /> </privateFonts>
The following sections describe attributes, child elements, and parent elements.
The following example demonstrates how to configure the reporting engine to use Ubuntu and Courier New fonts. The fonts are part of the project with the following properties:
- Build Action - Content
- Copy to Output Directory - Copy if newer
<?xml version="1.0"?> <configuration> ... <Telerik.Reporting> <privateFonts> <add fontFamily="ubuntu" path="Ubuntu-R.ttf" /> <add fontFamily="Courier New" path="CourI.ttf" fontStyle="Italic" /> <add fontFamily="Courier New" path="CourBI.ttf" fontStyle="Bold, Italic" /> </privateFonts> </Telerik.Reporting> ... </configuration>