RE: Fop fails to resolve embedded fonts after update from 2.6 to 2.7

Beat Hörmann <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
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

https://issues.apache.org/jira/browse/FOP-2861?attachmentSortBy=dateTime

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.