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

html to pdf - font family #2807

Closed
monsieur42 opened this issue Jul 9, 2020 · 2 comments · Fixed by #2834
Closed

html to pdf - font family #2807

monsieur42 opened this issue Jul 9, 2020 · 2 comments · Fixed by #2834

Comments

@monsieur42
Copy link

Hi there!

Is there any way to use custom fonts with the doc.html() function. If i add a font like described in the read me, and generate a pdf, from html where the font-family css attribute is set to the specific font. But in the generated pdf the text is displayed with the default font.

Thanks for your help,
Miklós

@monsieur42
Copy link
Author

I found the problem:

When i generated the js font file with your generator it set up the font family name like this 'Lato'. (Uppercase first character) But the doc.html() script called eventually the getFont function with 'lato' (lowercase), so the getFont function couldn't find the font, because in the fontmap array it was represented with the key 'Lato'.

So the issue can be hot fixed by rename the font with lowercase chars, but you should probably fix the getFont function to find the font anyway or convert all keys to lowercas in the fontmap array.

Cheers,
Miklós

@HackbrettXXX
Copy link
Collaborator

Storing the fonts in fontmap with all lowercase fonts sounds like a good idea. Could you prepare a pull request?

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

Successfully merging a pull request may close this issue.

2 participants