I'm having difficulties getting wkhtmltoimage to recognize fonts not installed on my CentOS 5.8 box.

I've tried installing the font I need (Verdana) via .rpm but that didn't seem to work.

I tried various webfont embedding methods and that didn't work either.

Does anyone know if I need to have GUI software installed (X11, Gnome, etc.) to allow wkhtmltoimage to use the fonts installed on the OS?

The fonts installed by the .rpm are found in:

/usr/share/fonts/msttcore/verdana.ttf
/usr/share/fonts/msttcore/verdanai.ttf
/usr/share/fonts/msttcore/verdanab.ttf
/usr/share/fonts/msttcore/verdanaz.ttf

Edit: Running fc-cache -f -v

/usr/share/fonts: caching, 0 fonts, 3 dirs
/usr/share/fonts/bitstream-vera: caching, 10 fonts, 0 dirs
/usr/share/fonts/default: caching, 0 fonts, 2 dirs
/usr/share/fonts/default/Type1: caching, 35 fonts, 0 dirs
/usr/share/fonts/default/ghostscript: caching, 8 fonts, 0 dirs
/usr/share/fonts/msttcore: caching, 31 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/OTF: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.fontconfig: not cleaning unwritable cache directory
fc-cache: succeeded

I'm afraid wkhtmltoimage still doesn't use my Verdana font.

  • This should have happened automatically but try running fc-cache -f -v. If that fixes it, cool, if not, check whether your fonts appear in that command's output. – terdon Jan 9 '14 at 23:41
  • Thank you for the suggestion, I've edited my original post to show the output. Unfortunately, despite the fonts being found by fc-cache, wkhtmltoimage still doesn't use them. – Not Available Jan 10 '14 at 16:22
  • OK, please explain 1) exactly how you installed the fonts, the whole command please and 2) How you are trying to use them with wkhtmltoimage and how they fail. – terdon Jan 10 '14 at 16:56

I had this problem and just fixed it.

Please follow this way :

wget http://www.my-guides.net/en/images/stories/fedora12/msttcore-fonts-2.0-3.noarch.rpm
rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm

then it will show correct type of lots of fonts.

And don't forget , For Centos that has not GUI libraries , You should install complete list of GUI libraries to get better results.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.