How do I specify custom fonts to use when printing a page with weasyprint?

1.6k Views Asked by At

It seems that weasyprint doesn't support the @font-face css directive. Is there a different method for specifying fonts to use when producing pdfs with weasyprint?

2

There are 2 best solutions below

0
On BEST ANSWER

The directive is not supported.

weasyprint relies on using only currently installed fonts, as can be found through Pango/fontconfig.

This short C program will list all the fonts that can be accessed.

This command will test for a specific font name (reference):

pango-view -t 'Some test text' --font 'AwesomeFont'
0
On

Make sure to run this on your linux box for all the MS fonts. It was the solution to my problem!

sudo apt-get install ttf-mscorefonts-installer