I had the same problem when changing to fop 2.7. The problem is that the font-manager doesn't honor the custom resource resolver passed to the fop builder anymore. I described a workaround in


Basically with 2.7 you need to extra pass your resource solver to the font-manager.

On 2022/08/07 11:56:33 Stefan Kleinbaum wrote:
> Hi!
> I've googled for breaking changes of an apache fop 2.6 -> 2.7 update, but I
> have got nowhere.
> After a fop update from 2.6 to 2.7, my application fails to resolve
> embedded font files from the jar classpath. A resolver is registered at
> "new FopFactoryBuilder(new File(".").toURI(), resolver)",
> "transformerFactory.setUriResolver(resolver)" and
> "transformer.setURIResolver(resolver)" but get's not called on embedded
> fonts. However, this stacktrace is printed:
> SEVERE: Failed to read font file myProject/fonts/myFont.ttf (No such file
> or directory)
> java.io.FileNotFoundException: <basePath (from new
> File("."))>/myProject/fonts/myFont.ttf (No such file or directory)
> at java.io.FileInputStream.open0(Native Method)
> at java.io.FileInputStream.open(FileInputStream.java:195)
> at java.io.FileInputStream.<init>(FileInputStream.java:138)
> at java.io.FileInputStream.<init>(FileInputStream.java:93)
> at
> sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
> at
> sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
> at java.net.URL.openStream(URL.java:1045)
> at
> org.apache.fop.apps.io.ResourceResolverFactory

To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to