xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "simon steiner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FOP-2600) font-base from the config is ignored
Date Wed, 20 Apr 2016 09:59:25 GMT

    [ https://issues.apache.org/jira/browse/FOP-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15249578#comment-15249578
] 

simon steiner commented on FOP-2600:
------------------------------------

Try using
        FopFactoryBuilder confBuilder = new FopConfParser(fopxconf, new URI("uri")).getFopFactoryBuilder();
        FopFactory fopFactory = confBuilder.build();

or provide a complete example of how your calling fop

> font-base from the config is ignored
> ------------------------------------
>
>                 Key: FOP-2600
>                 URL: https://issues.apache.org/jira/browse/FOP-2600
>             Project: FOP
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: adam Retter
>
> It seems that fonts are not being resolved relative to the font-base
> config parameter in 2.1, instead they are being resolved directly by
> the ResourceResolver. This looks like a bug to me, can anyone confirm?
> I have a FOP configuration file like this:
> <fop version="1.0">
>     <!-- Strict user configuration -->
>     <strict-configuration>true</strict-configuration>
>     <!-- Strict FO validation -->
>     <strict-validation>false</strict-validation>
>     <!-- Base URL for resolving relative URLs -->
>     <base>./</base>
>     <!-- Font Base URL for resolving relative font URLs -->
>     <font-base>http://localhost:8080/exist/apps/tei-simple/resources/fonts/</font-base>
>     <renderers>
>         <renderer mime="application/pdf">
>             <fonts>
>                 <font kerning="yes"
>                     embed-url="Junicode.ttf"
>                     encoding-mode="single-byte">
>                     <font-triplet name="Junicode" style="normal"
> weight="normal"/>
>                 </font>
>                 <font kerning="yes"
>                     embed-url="Junicode-Bold.ttf"
>                     encoding-mode="single-byte">
>                     <font-triplet name="Junicode" style="normal" weight="700"/>
>                 </font>
>                 <font kerning="yes"
>                     embed-url="Junicode-Italic.ttf"
>                     encoding-mode="single-byte">
>                     <font-triplet name="Junicode" style="italic"
> weight="normal"/>
>                 </font>
>                 <font kerning="yes"
>                     embed-url="Junicode-BoldItalic.ttf"
>                     encoding-mode="single-byte">
>                     <font-triplet name="Junicode" style="italic" weight="700"/>
>                 </font>
>             </fonts>
>         </renderer>
>     </renderers>
> </fop>
> And I instantiate FOP like so:
> ResourceResolver resolver =
> ResourceResolverFactory.createSchemeAwareResourceResolverBuilder(ResourceResolverFactory.createDefaultResourceResolver()).build();
> EnvironmentProfile environment =
> EnvironmentalProfileFactory.createDefault(new URI("file:///db"),
> resolver);
> final FopFactoryBuilder = builder = new
> FopFactoryBuilder(environment).setConfiguration(configFile);
> final FopFactory fopFactory = builder.build();
> When I run my FO transformation I then get an error like:
> Caused by: java.io.FileNotFoundException: /Junicode.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$NormalResourceResolver.getResource(ResourceResolverFactory.java:224)
> at org.apache.fop.apps.io.ResourceResolverFactory$TempAwareResourceResolver.getResource(ResourceResolverFactory.java:152)
> at org.apache.fop.apps.io.ResourceResolverFactory$DefaultResourceResolver.getResource(ResourceResolverFactory.java:121)
> at org.apache.fop.apps.io.ResourceResolverFactory$SchemeAwareResourceResolver.getResource(ResourceResolverFactory.java:256)
> at org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)
> at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:103)
> at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:93)
> at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:124)
> at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:108)
> at org.apache.fop.fonts.LazyFont.load(LazyFont.java:116)
> When I look through the FOP 2.1 code-base I see that the `font-base`
> only seems to be read in FontManagerConfigurator#configure, however
> that code-path is never executed when I run my app.
> Any thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message