Skip to content

Commit a7d0372

Browse files
Fix for bug FOP-3109 #6
1 parent c38b17a commit a7d0372

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/config/FopConfigClassLoader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
import org.apache.fop.apps.FopFactory;
88
import org.apache.fop.apps.FopFactoryBuilder;
9+
import org.apache.fop.apps.io.InternalResourceResolver;
10+
import org.apache.fop.apps.io.ResourceResolverFactory;
911
import org.apache.fop.configuration.DefaultConfigurationBuilder;
12+
import org.apache.xmlgraphics.io.ResourceResolver;
1013
import org.fugerit.java.core.lang.helpers.ClassHelper;
1114
import org.fugerit.java.doc.mod.fop.FopConfig;
1215

@@ -38,8 +41,13 @@ public FopConfigClassLoader(String fopConfigPath, String defaultFontPath) {
3841
@Override
3942
public FopFactory newFactory() throws Exception {
4043
InputStream fopConfigStream = ClassHelper.loadFromDefaultClassLoader( this.getFopConfigPath() );
41-
FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), new ClassLoaderResourceResolver( this.getDefaultFontPath() ));
44+
ResourceResolver customResourceResolver = new ClassLoaderResourceResolver( this.getDefaultFontPath() );
45+
FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), customResourceResolver);
4246
FopFactory factory = builder.setConfiguration(new DefaultConfigurationBuilder().build(fopConfigStream)).build();
47+
// fix for bug https://github.com/fugerit-org/fj-doc/issues/6 - start #6
48+
InternalResourceResolver irr = factory.getFontManager().getResourceResolver();
49+
factory.getFontManager().setResourceResolver( ResourceResolverFactory.createInternalResourceResolver( irr.getBaseURI(), customResourceResolver ) );
50+
// fix for bug https://github.com/fugerit-org/fj-doc/issues/6 - start #6
4351
fopConfigStream.close();
4452
return factory;
4553
}

0 commit comments

Comments
 (0)