Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to issue warning if requested font is not installed on the system #2310

Open
venthur opened this issue Nov 23, 2024 · 2 comments
Open

Comments

@venthur
Copy link

venthur commented Nov 23, 2024

Hi,

would be helpful to have an option to the CLI to issue a warning if a requested font is not installed on the system. I understand that weasyprint uses fc-match to find a matching font in this case (which is great), but in cases users require an exact font match, it is cumbersome to check if all requested fonts are in the resulting pdf.

@liZe
Copy link
Member

liZe commented Nov 24, 2024

Hi!

Thanks for this feature request.

Fonts defined in CSS never perfectly match with installed fonts, and it’s hard to agree on a reliable way to separate what’s OK and what’s not OK for users: do we accept case mismatches, ignore spaces/hyphens/underscores, check font weights, font styles, Unicode planes, filenames?

If we add a CLI option, we’ll have to deal with these different options, and that’s something we’d like to avoid. 😄

Hopefully, there are quite simple solutions to check that the fonts in your generated PDF correspond to what you want. For example, pdffonts, provided by Poppler, can list the fonts included in a PDF, and you can write a one-line command that warn you if the fonts you expect are missing.

That’s a little extra work for users, but it’s really more flexible in my opinion. I don’t know your use case (you can tell more about it if you want!), would that be a good solution for you?

@liZe
Copy link
Member

liZe commented Nov 24, 2024

(More about font matching and warnings in #2083.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants