Forum How do I...?

Warning if typeface is missing?

_savage
I work with somewhat exotic characters, for example from the “Latin Extended Additional” code page of the unicode space. Now it happens that sometimes a .ttf font that I used to build the PDF doesn't provide a letter for such an exotic character in which case Prince seems to default to a font which does.

How can I get Prince to warn me?
mikeday
You could run Prince with the --verbose command-line option, in which case it will print out which fonts were used in the document. There isn't actually a way to trigger a warning unless the character isn't found in any of the specified fonts.
_savage
Thanks, that worked. You're right though, it doesn't warn me explicitly. Likewise, if the font I want to use does not provide an "Italic" or "Bold" then I assume Prince approximates or replaces with a default font?

So it seems that if I see e.g. the Times font used then something has defaulted and I ought to check the fonts I specified in the style sheets?
mikeday
Yes. Prince can also synthesize bold/italic fonts by slanting or overprinting, unless --no-artificial-fonts has been specified.
_savage
Thanks Mike :)

Would it be hard to add the warning in, so that I know which particular character doesn't have a typeface? That'd be helpful for me to figure out where in the text it's acceptable to default, or if I should revisit my font choices.
mikeday
We can do it by adding a new special font family "prince-no-fallback", which will inhibit the usual fallback mechanism. Then if your document looks like this:
<p style="font-family: Trebuchet MS, prince-no-fallback">hello 日本</p>

The Trebuchet MS font has no Japanese characters, so normally we would fallback to a font that does, but the no-fallback font family inhibits this, causing warnings:
warning: no glyphs for character U+65E5, fallback to '?'
warning: no glyphs for character U+672C, fallback to '?'

Does that sound like it would be helpful?

Edited by mikeday

_savage
That would be perfect! :)
dauwhe
+1
mikeday
Right we'll do it, but it won't be in Prince 9 rev 3, as we are already half way through building the release packages. Next time!
_savage
That's alright, looking forward to the feature though :D

Thank you, Mike!
thomasdumm
+1, so easily realize if I use a font for maths that does not contain characters/symbols appearing in MathML code.

www.delivros.ch

Edited by thomasdumm

_savage
This didn't make it into r4, did it?
mikeday
No, it will be included in a future release.
mikeday
This feature was included in Prince 10, available now. :)