Forum How do I...?

Problem with an HTML entity


i'm using xhtml+css to write a report that contains some basic statistics formulas. When I produce a pdf output with Prince, the entity ∼ (∼) prints like a '?'

By searching a bit on the forum, I suppose that this is caused by the font I'm using in the document (Times) which doesn't support this entity, but how can I solve this problem ?


You can list several fonts like

body {font-family:"Times New Roman", Code2000, serif;}

Then Prince will use Times New Roman for most of the text and Code2000 for characters that are not available in Times New Roman. Note however that Prince embedds fonts in PDF output so using multiple fonts increases size of PDF output.
Thanks for reply, it is now working, but I've had problems to figure out what was going on.
As long as I kept putting the entity into a TT element, nothing happened, I kept having that '?' in my output. Is it a feature that there is no font fallback if a character is not found in the default TT font ?
Otherwise I may have caught a bug...
Is it a feature that there is no font fallback if a character is not found in the default TT font ?

It's a feature that Prince scans only fonts specified in font-family property for given element. It does not check whole database of installed fonts.
What makes some XHTML elements special is declaration in default style sheet
Quoted from engine/style/xhtml.css
tt, code, kbd, samp, pre { font-family: monospace }

that limits character switching to the following fonts
Quoted from engine/style/fonts.css
@font-face {
    font-family: monospace;
    src: local("Courier New"), local("Courier"), local("Unispace"), local("OpenSymbol")

You can change this beheaviour either by modifying xhtml.css and/or fonts.css or by overwritting font-family via author's CSS like
tt {font-family:"courier new", FreeMono, monospace;}

provided that second font has good coverage of required Unicode ranges.