I am developing on windows plattform. My maven project has the following structure for font resources:
src/main/resources/package/name/fonts
I try to register a font as following:
FontFactory.register("package/name/fonts/fontname.otf");
But I get the error:
package/name/fonts/fontname.otf not found as file or resource
What is my failure?
Thank you
First I get the correct path with getResource():
String pathtofont = "/package/name/fonts/fontname.otf";
String fontname = myworkingclass.class.getResource(pathtofont).toString();
then I get it registerd:
FontFactory.register(fontname);
Important is that the path to font starts with a /.