Forum Bugs

Bold font is not selected by the Windows build

This issue is noticed during my test of the new features of build 20230306. With the attached HTML file, the Windows build fails to select the Bold version of HONOR Sans CN (a free Chinese font released at the end of last year); the Regular version is embedded instead.

The Linux version on Ubuntu 22.04 works fine. And on the same Windows machine, the Linux version running inside WSL Ubuntu 22.04 also works fine (with C:\Windows\Fonts linked to ~/.fonts).

Other Chinese fonts I've tested don't have this problem, e.g. Microsoft Yahei, HarmonyOS Sans SC, and Source Han Sans SC. (By the way, for CJK glyphs, HONOR Sans CN can be used as a drop-in replacement of the non-free Microsoft Yahei font; they originate from the same designer and the same vendor company.)

For convenience the HONOR Sans CN font files are shared here.
  1. hello.html0.5 kB
Thanks, we will investigate this issue.
Hi yyang,

I've inspected the Bold version of HONOR Sans CN, and what I've been able to find is that its Windows-specific metadata specifies the font's family as "HONOR Sans CN Bold" instead of just "HONOR Sans CN". It appears that Prince is unable to find the Bold variant as a result.

Using your example, if you were to instead do something like:
    <h1 style="font-family: 'HONOR Sans CN Bold'">你好,世界!</h1>
    <h1 style="font-family: 'HONOR Sans CN'; font-weight: normal">你好,世界!</h1>

you will notice that both Regular and Bold versions are correctly embedded in the output PDF.

I am able to reproduce this issue with Prince 14, so clearly this issue isn't new. Chrome and Firefox are capable of finding the Bold version of the font despite the name difference, so I imagine we'll eventually have to figure out how to do the same.
Thank you very much for the clear answer! Fonts can be naughty indeed.