This is closely related to (and stems from the same issue as) What is the Debian equivalent of urw-fonts (needed for utf-8 in wkhtmltopdf)?
But I think this is a valid question on its own. As described in the link, I'm trying to convert a multi-language utf-8 html document to pdf using wkhtmltopdf (via command line in Debian). Several of the languages are not being rendered correctly and show up as white or black rectangles, presumably because wkhtmltopdf cannot find or access the necessary fonts.
Question: where on the system (Debian) does wkhtmltopdf look for fonts, and how can I check which font(s) it's looking for (if possible) given a particular command?
The fonts are under /usr/share/fonts/
.
This command shows which fonts the command foo
access.
strace -e open -o >(sed -n '/^open("\/usr\/share\/fonts\//p') foo
strace
shows syscalls. -e open
means to only show syscalls to open files. -o >(sed -n '/^open("\/usr\/share\/fonts\//p')
means to output the output to sed, which prints out only syscalls to open files in /usr/share/fonts/
.
For some programs, it is useful to turn on verbose output and check its stderr if it says what fonts are used.
For your specific problem, also check that the encoding of the HTML files are specified correctly.
Take for example the output from strace
open("/usr/share/fonts/X11/Type1/n019004l.pfb", O_RDONLY) = 8
It's in the same format as how you would use open
in a c program. /usr/share/fonts/X11/Type1/n019004l.pfb
is the path to the file. O_RDONLY
means to open it read-only. 8
means the operation succeeded, and the resulting file descriptor is 8. Refer to the open man page.