Forum How do I...?

Font not loading

nikhiltri
Hello,

I'm trying to use Prince to generate a PDF for this page: https://staging.artic.edu/my-museum-tour/241/pdf-layout?print=true.

Fonts are referenced by external URLs and Prince seems to be loading them, but generation is breaking and the logs say it's due to no fonts being found. Here are the logs:

Wed Oct  9 20:49:37 2024: ---- begin
...
Wed Oct  9 20:49:37 2024: loading style sheet: https://cloud.typography.com/612324/7579192/css/fonts.css
...
Wed Oct  9 20:49:38 2024: Converting document...
Wed Oct  9 20:49:38 2024: loading font: https://www.artic.edu/fonts/sabon/3545D5_0_0.woff2
Wed Oct  9 20:49:38 2024: used font: , ☞
Wed Oct  9 20:49:38 2024: loading font: data URL
Wed Oct  9 20:49:38 2024: loading font: data URL
Wed Oct  9 20:49:38 2024: used font: Copyright (C) H&Co | typography.com, Copyright (C) H&Co | typography.com
Wed Oct  9 20:49:38 2024: used font: Copyright (C) H&Co | typography.com, Copyright (C) H&Co | typography.com
Wed Oct  9 20:49:38 2024: loading font: data URL
Wed Oct  9 20:49:38 2024: used font: Copyright (C) H&Co | typography.com, Copyright (C) H&Co | typography.com
Wed Oct  9 20:49:38 2024: loading font: data URL
Wed Oct  9 20:49:38 2024: used font: Copyright (C) H&Co | typography.com, Copyright (C) H&Co | typography.com
Wed Oct  9 20:49:38 2024: warning: Ensure fonts are available on the system or load them via a @font-face rule.
Wed Oct  9 20:49:38 2024: warning: For more information see:
Wed Oct  9 20:49:38 2024: warning: https://www.princexml.com/doc/help-install/#missing-glyphs-or-fonts
Wed Oct  9 20:49:38 2024: internal error: Unable to find any available fonts.
Wed Oct  9 20:49:38 2024: finished: failure
Wed Oct  9 20:49:38 2024: ---- end


Any guidance would be helpful!

Thanks!
nikhil
mikeday
Presumably there is some text in the document that has no font-family specified for which Prince is attempting to use the serif font, which defaults to Times New Roman or several equivalents like DejaVu Serif. If these are not available then Prince will be unable to process the text.

Is this a Linux server with no system fonts installed?
nikhiltri
Ah, ok, that might be the case. This is an EC2 instance running Amazon Linux 2023. More than likely, no fonts are installed on the system. I'll look to see if there is a way to install a default set of fonts on there.
mikeday
If the system has Fontconfig installed then it should be possible to install some default system fonts, otherwise you can upload the font files yourself and point to them with @font-face rules:

https://www.princexml.com/doc/help-install/#missing-glyphs-or-fonts
nikhiltri
Yup, the system had no fonts installed. I installed DejaVu fonts and it's working again. Thanks!