Certain configuration prevents custom fonts to show in HTML reports

Background

Custom fonts can be added by placing a Fonts.xml file in "\xmldb\Objects\" using "\apps\scitegic\core\xml\Objects\FontsTemplate.xml" as a template.

Problem

The custom font defined (Verdana Bold in this example) was not picked up in the HTML report generated using the HTML Report Viewer. When looking at the report using the browser's Developer Tools, an error shows up:

HTML%20Report1.htm:7 Not allowed to load local resource: file:///C:/WINDOWS/Fonts/verdanab.ttf

Further examination shows that the generated HTML report contains a line like:

For security reasons, modern browsers don't allow access to local files so if such a reference is present in the HTML, this is expected.


Solution

It turns out that the line with a reference to a local file is generated when there are two Fonts.xml files present on the server:

  • \apps\scitegic\core\xml\Objects\Fonts.xml
  • \xmldb\Objects\Fonts.xml

It does not matter if the two files have different content or are identical. As long as there are two files present, the local file reference is generated in the HTML.

The history behind the two locations is that originally, custom fonts were defined in the Core package folder. But since everything under "\apps\scitegic\" will be deleted and replaced during an upgrade, it’s not a good idea to have customized files in this location. At some point, it was made possible to have the Fonts.xml file in "\xmldb\Objects" instead as the files in this location are preserved during an upgrade. Typically, you also copy this folder when migrating to a new server.

So the solution is to make sure that you ONLY keep the Fonts.xml file in "\xmldb\Objects".