The Report Item is Rendered with an Incorrect Font on the First Render in Azure
Environment
Product | Progress® Telerik® Reporting |
Project Type | ASP.NET Core |
Description
When viewing a report that is rendered in Azure environment, the font is replaced on the first instance of that report item/section with the default font for the OS. The rest of the report is rendered with the custom font as expected. The same report renders correctly(including the first instance) locally.
Our reporting engine requires the fonts to either be installed in the hosting environment or to be referenced through the use of the privateFonts element.
Installing a font on an Azure app service can sometimes be not an easy task so people end up using the privateFonts
variant.
This turns out to also be tricky because the wwwroot
folder gets duplicated in Azure Web apps and if the font is in there, that could mess up the path where the reporting engine looks for to find the font.
Steps to Reproduce
Host a .NET Core web application project on Azure, then use it to render a report that display text with custom font.
Solution
Known issue with Azure App Services: The required .NET API for handling private fonts is making GDI calls that are blocked in Azure App Services. Our recommendation is to use Cloud Service plan. More details can be found in Custom Fonts not working on Azure App Service.
-
Ensure that the fonts are present in the
wwwroot
folder of the project(which is the root folder of the app when it is run in Azure App service)"telerikReporting": { "privateFonts": [{ "fontFamily": "ubuntu", "path": "Ubuntu-R.ttf", }] }
-
Invoke the
UseStaticFiles
method at the end of theConfigure
method inStartup.cs
/Program.cs
to resolve the wwwroot duplicate problem.public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { .... app.UseStaticFiles(); }