Closed hamedsharifi closed 7 months ago
Hi, Have you tried installing the fonts in the src/main/resources directory in your application?
I am also getting the error com.mewebstudio.captcha.exception.FontLoadException: Load custom fonts failed!
. I do have my font in src/main/resources/fonts/zxx-bold-regular.ttf
.
Hello. Thanks for great work. how can I set custom font when I packaging my app to a jar file? I get "error in loading custom fonts".
After a few hours of tinkering, I have figured out that the path you provide to your font is very important. My app is running in a docker. I realized that since my docker base image uses alpine, it wouldn't have system fonts. So I added into my dockerfile to copy my custom font to /usr/share/fonts
and used that path in my code. This worked perfectly!
If you aren't using docker, check your paths and be mindful of your system environment.
Thank you for your reply. I modified the source to feeding custom fonts as input streams so this way I don't worrying about copying fonts to the container.
Thank you for your reply. I modified the source to feeding custom fonts as input streams so this way I don't worrying about copying fonts to the container.
Thank you for the feedback. This will be the solution for many people.
Hello. Thanks for great work. how can I set custom font when I packaging my app to a jar file? I get "error in loading custom fonts".