Hi there,
I’ve been working on a custom theme lately, doing a lot of reading of the various guide pages and I don’t know how many forum posts (though many seem to have been from prior to some major changes made last year in relation to fonts). In the process I’ve run into an interesting and apparently previously unquestioned issue with using custom font families.
Whilst many issues I’ve read about seem to have been from broken custom themes people have produced, this issue is reproducible with the default “Plain” theme, and any theme I’ve tested.
I understand that the “font-family: NAME” style attribute requires that the font family be installed on the system. So, whilst I’d normally use a font manager (which every other program has no issue with, including within the ‘View’ of the theme in Manager) I figured hard-installing one family the old way isn’t going to cause major drama. I’m using Windows 10 (v2004, b19041.388), so installed the font by the standard method of ‘Right Click’ > ‘Install for all users’, which results in a UAC elevation and the font being installed alongside all other system fonts in C:\Windows\Fonts .
During testing this, I isolated the issue so it is reproducible with the default “Plain” theme by only adding “font-family: xx” in one specific location, in this case line 6 (i.e. the document title):
<td style="font-weight: bold; font-size: 32px">{{ title }}</td>
became:
<td style="font-family: Jost; font-weight: bold; font-size: 32px">{{ title }}</td>
In this example I’m using Jost (Jost - Google Fonts); for branding reasons it’s what I hope to use in the end. What results from this is:
You can see that for some reason the PDF export substituted Jost for OCRAStd, which is some other font within C:\Windows\Fonts (it’s licensed from Adobe, so I assume was installed with some adobe software).
Now if I pick another font family which I know comes with Windows itself, say Arial (or Agency FB, as in the guide example), it works as expected:
My first suspicion was that for some reason user (even admin) installed fonts would fail for some reason and be substituted in the same way, however that OCRAStd font itself was most likely installed by the admin user (i.e. what occurs when elevating a software installer via the UAC prompt). To test this more specifically I found some other font families installed by/with 3rd party software and they all work correctly in the PDF output if they were installed to C:\Windows\Fonts. If they’re “installed” to another location the same substitution with OCRAStd occurs. In this case by “installed” I mean visible in the font list in Windwos 10 Settings > Personalisation > Fonts, and/or Control Panel > Fonts, but located in an unusual location such as some application’s Program Files folder.
My next suspicion was (and still is) that it’s something to do with the Windows font cache service. All I’ve done to test that so far was closing manager, installing the font to C:\Windows\Fonts as above, restarting the computer, and re-opening manager; unfortunately the results were the same, so I’m stuck.
Any ideas what might be happening?
Manager v20.8.23
edit after solution:
I didn’t notice until now that even when the correct font carries through to the PDF the font weight is wrong (i.e. the font-weight style attribute seems to be ignored in PDF output). See posts 6 and 7 below for the combined solution