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

Google font Roboto won't load #360

Closed
Alisamix opened this issue Jun 21, 2019 · 3 comments
Closed

Google font Roboto won't load #360

Alisamix opened this issue Jun 21, 2019 · 3 comments

Comments

@Alisamix
Copy link

Hi,

thanks for this library, it really makes things easier for me.

Initially, using the Roboto font worked without any problems.

@font-face {
font-family: 'Roboto';
src: url(fonts/RobotoRegular.ttf);
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Roboto';
src: url(fonts/RobotoBold.ttf);
font-weight: bold;
font-style: normal;
}
body {
font-family: 'Roboto';
}

But after I changed something irrelevant (content of a textnode), I am now getting this message in the console, and it falls back on the default font:

15:43:37,694 INFO [com.openhtmltopdf.load] (default task-26) Loading font(Roboto) from InputStream supplier now. 15:43:37,695 WARNING [com.openhtmltopdf.exception] (default task-26) Couldn't load font. Please check that it is a valid truetype font. 15:43:37,695 WARNING [com.openhtmltopdf.exception] (default task-26) Font metrics not available. Probably a bug. 15:43:37,700 WARNING [com.openhtmltopdf.render] (default task-26) Font is null. 15:43:37,700 WARNING [com.openhtmltopdf.render] (default task-26) Font is null.

I checked the paths and the files, renamed them etc, but for some reason I get this error. How should I move forward with this issue?

@Alisamix
Copy link
Author

Okay, turns out that the files get corrupted - the size of a .ttf file goes from 167kb to 254kb. Weird.

@syjer
Copy link
Contributor

syjer commented Jun 22, 2019

@Alisamix if you are using maven as a build tool, ensure that the maven-resources-plugin is not doing any filtering on all your resources. (you will need to specify a pattern :D)

For gradle, it may be something similar.

@Alisamix
Copy link
Author

@Alisamix if you are using maven as a build tool, ensure that the maven-resources-plugin is not doing any filtering on all your resources. (you will need to specify a pattern :D)

For gradle, it may be something similar.

That was indeed the problem. Fixed it by excluding filtering on the resources folder, thanks!

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