Forums

Weasyprint Font Options

Hi there! I have an issue with font configuration, and would like to know what my options are. I have the following scenario, typed out in steps:

  1. Initiate Flask App
  2. A user fills out a form (Flask-WTF)
  3. Flask processes the user inputs, outputs it into a pdf with custom CSS
  4. One of the user inputs is additionally marked with CSS with a different font-family - more specifically, a user's signature

I started out using wkhtmltopdf, and I liked that it would render templates with whatever CSS framework was linked in the header. I saw that WeasyPrint was already integrated with pythonanywhere, so I refactored and used FontConfiguration() instead.

If the font is installed on my local end, it will render correctly. However, the times I tried using web-fonts, it renders it incorrectly. I'd like to know the following:

  1. Does anyone know if there's a Linux font that's already installed on the system that I can use for a signature? If so, then hey! I'll just use that.
  2. Otherwise, is there a way to install a font? and if so, what formats? I'm assuming as long as it's in the system, I can call it through WeasyPrint's CSS configuration system.

Looks like the weasyprint docs answer your questions: http://weasyprint.readthedocs.io/en/stable/features.html#fonts