Forum How do I...?

Can i use external fonts?

asdf
I've got this error:
> prince --debug index.htm -o file.pdf
...
prince: debug: font request: serif
prince: debug: font scan: serif
prince: debug: font scan: serif, 0 matches
prince: debug: font request: Fira-Mono, monospace
prince: debug: font scan: monospace
prince: debug: font scan: monospace, 0 matches
prince: debug: font request: Charter-Racket, serif
prince: debug: font request: bold Cooper-Hewitt
prince: internal error: no available fonts


I don't want to install fonts in the entire system, but i have directory with these fonts.
So, here is the question - can i use not system fonts? I mean, something like this:
> prince --fonts-dir my-fonts -o f.pdf index.html

Edited by asdf

mikeday
You can run "prince --scanfonts my-fonts/*.ttf > myfonts.css" (or *.otf or whatever) and Prince will generate a CSS file with @font-face rules.

However, in some situations Prince will still be trying to find one of the default serif fonts it expects, like Times New Roman or DejaVu Serif, so it would help to have one of those as well.
twantzen
Is it possible to use web-hosted fonts? E.g. Google fonts via
<link href="https://fonts.googleapis.com/css?family=EB+Garamond" rel="stylesheet">


Thanks, Tobias
mikeday
Yes you can use web fonts with Prince.