Progress® Telerik® Reporting R3 2017

privateFonts Element

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.

Caution note Caution

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

Caution note Caution

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>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

<privateFonts> element
AttributesNone
Child Elements
  • add - Optional element. Adds a font to the collection.
Parent Elements
  • configuration - Specifies the root element in every configuration file that is used by the common language runtime and the .NET Framework applications.
  • Telerik.Reporting - Configures all settings that Telerik Reporting Engine uses.
<add> element
Attribute
fontFamily The attribute is required and case sensitive.
path The attribute is required and is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see MSDN Directory.GetCurrentDirectory Method () For web projects you can use ~ operator to specify a root-relative path for a font. For more informarion see MSDN: ASP.NET Web Project Paths
fontStyle The attribute is optional with valid values Regular, Bold, Italic, Strikeout and Underline. The default value is Regular. Specify this attribute if you have to specify font family with multiple font files for different style or if specified font file is not containing Regular style.

Child elements

None

Parent element

privateFonts

Example

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>

See Also