Forum Bugs

Fontconfig errors

juandj
Hello,

We're considering purchasing the server license, but we have been unable to get the trial version working.

I installed the Suse RPM.

I am running the following on OpenSUSE 10.3:

prince -o apple.pdf WHATEVER_URL_HERE (couldn't post urls)


I get:

Fontconfig warning: line 32: unknown element "cachedir"
Fontconfig warning: line 33: unknown element "cachedir"
Fontconfig warning: "/etc/fonts/conf.d/50-suse-pre-user.conf", line 27: invalid match target "scan"
prince: WHATEVER_URL_HERE:103: error: Attribute id redefined
prince: WHATEVER_URL_HERE:120: error: htmlParseEntityRef: expecting ';'
prince: WHATEVER_URL_HERE:127: error: ID worldwide already defined
prince: WHATEVER_URL_HERE:172: error: Unexpected end tag : iframe
prince: internal error: no available fonts


Fontconfig is an out-of-the box installed and the system doesn't have anything custom or anything extraordinary..


Thank you in advance for any help[/code]
mikeday
The fontconfig warnings are annoying, but may not cause any actual problems. Which SUSE version are you running?

You should be able to fix the "no available fonts" error by installing the msttcorefonts package or editing the fonts.css file in /usr/lib/prince/style to point to other fonts (eg. the DejaVu fonts).
juandj
It's SUSE 10.3... I dont mind it showing errors, but it's not generating a pdf at the end.

I'll try installing the corefonts, but they require ttmkfdir, which I haven't been able to install...
mikeday
If you can't install the msttcorefonts package, choose some different fonts that you already have installed to use for the default font families (serif, sans-serif, monospace) and add them to fonts.css.
juandj
could you give me an example of how it'd look like for dejavu fonts?

thank you kindly.
mikeday
First, check that fontconfig is working by running Prince with the --debug command-line option, eg. "prince --debug foo.html". It should print out a list of font families, including "DejaVu Serif" and "DejaVu Sans". If it doesn't, then you'll need to refer to them using the exact filename. (They're probably in /usr/share/fonts/truetype/ttf-dejavu, or somewhere nearby).

Edit /usr/lib/prince/style/fonts.css to have:
@font-face {
    font-family: serif;
    src: local("DejaVu Serif")
}

and repeat for sans-serif and monospace. If fontconfig isn't detecting these fonts then you'll need to refer to them by filename:
@font-face {
    font-family: serif;
    font-weight: normal;
    font-style: normal;
    src: url("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf")
}

and repeat for bold, italic, and bold-italic. If you don't have the DejaVu fonts, then use whatever default fonts 10.3 comes with as substitutes for Times New Roman / Arial / Courier New; every system has them, but they might call it something else.
juandj
That did the trick!

thanks!