Forum Bugs

Error: no glyphs for character

bookdev
Running: prince http://en.wikipedia.org/wiki/British_Indian_Ocean_Territory -o out.pdf

Gives the errors below. Basically, it displays 10 characters as "?". Any idea why? The characters display fine in my browser and word processing software in the installed font MV Boli.

I'm surprised since Prince is generally great at font substitution.

ERRORS:
prince: warning: no glyphs for character U+078A, fallback to '?'
prince: warning: no glyphs for character U+07AD, fallback to '?'
prince: warning: no glyphs for character U+0780, fallback to '?'
prince: warning: no glyphs for character U+07A6, fallback to '?'
prince: warning: no glyphs for character U+0782, fallback to '?'
prince: warning: no glyphs for character U+07B0, fallback to '?'
prince: warning: no glyphs for character U+078B, fallback to '?'
prince: warning: no glyphs for character U+07A9, fallback to '?'
prince: warning: no glyphs for character U+0784, fallback to '?'
prince: warning: no glyphs for character U+07AA, fallback to '?'
prince: warning: get_gpos_adjust: pos_pair_unknown:{adjust(0, 0, -76, 0), adjust
(0, 0, 0, 0)}
prince: warning: get_gpos_adjust: pos_pair_unknown:{adjust(0, 0, -113, 0), adjus
t(0, 0, 0, 0)}
prince: warning: get_gpos_adjust: pos_pair_unknown:{adjust(0, 0, -188, 0), adjus
t(0, 0, 0, 0)}
prince: warning: get_gpos_adjust: pos_pair_unknown:{adjust(0, 0, -188, 0), adjus
t(0, 0, 0, 0)}
mikeday
Prince doesn't know about the MV Boli font. You will need to add it to the default fonts.css style sheet. Currently for Hindi/Devanagari we specify "Mangal" on Windows and "Lohit Hindi" on Linux.

I am interested to see those get_gpos_adjust warnings, do you know which font is causing those?
mikeday
Woops, spoke too soon there. Those code points are actually Thaana characters used by the Dhivehi language, not Devanagari/Hindi at all. Prince does not yet support this script, unfortunately. If you add the font to fonts.css then Prince will get the necessary glyphs from it, but script-specific shaping rules will not be applied.
bookdev
OK. Could you please be so kind as to let me know how to build a fonts.css of all local fonts, if you don't mind?

I tried:
prince --scanfonts "Control Panel\Appearance and Personalization\Fonts\*.*" > c:\font.css
But got error: cannot open resource
(This is the address you enter in Windows Explorer to get see the fonts.)

I then tried copying all fonts from the Control Panel to a separate directory and scanned them there. But the resulting font.css points to the fonts in that directory and I would rather not maintain a 1GB duplicate copy of fonts.

I added the scan to the default fonts.css style sheet so it now has:
/* MV Boli, Regular */
@font-face {
font-family: "MV Boli";
font-weight: normal;
font-style: normal;
font-stretch: normal;
src: url("c:\fonts\mvboli.ttf")
}

Yet when I re-run:
prince http://en.wikipedia.org/wiki/British_Indian_Ocean_Territory -o out.pdf
...I get the exact same errors. So Prince still doesn't seem to be using MV Boli for the missing characters. Any idea why?

Also, the scanfonts generated to lots errors like:
Thu Oct 21 10:40:27 2010: c:\fonts\symbol.ttf: error: cannot open resource
Thu Oct 21 10:40:27 2010: c:\fonts\tahoma.ttf: error: cannot open resource
Any idea why Prince can't open standard Windows fonts?
mikeday
The real folder that the fonts are stored in should be something like "C:\Windows\Fonts". Adding a @font-face rule for MV Boli will allow it to be referenced by name from the font-family property. However, you will also want to add it to the default "serif" font family so that it can be used even when not explicitly requested.
bookdev
--scanfonts C:\Windows\Fonts worked. Thanks, Mike.

Adding @font-face {font-family: serif; src: local("MV Boli")} to fonts.css also seemed to work (except for the get_gpos_adjust warnings which you explained).

Should I also add @font-face {font-family: sans-serif; src: local("MV Boli")} to fonts.css so Price can access it for sans-serif PDFs?

Would it slow Prince down if I added all 160 fonts that come with Windows to fonts.css in this fashion?
mikeday
The sans-serif family falls back to serif if it can't find any glyphs, so there is no need to add fonts to both. Adding all 160 fonts may not be helpful, as it could lead to Prince using a font you don't expect in ways that are difficult to track down. I don't think it would have any major effect on speed, though.

I have not been able to reproduce the get_gpos_adjust warnings. Can you try running Prince with the --verbose option to see exactly which fonts are being used?
mikeday
The get_gpos_adjust warnings should be fixed in Prince 8.0.