Fonts in the class path makes fonts listing fail

Maxime Bégnis <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
When using fonts embedded in a .jar file in the class path
(https://xmlgraphics.apache.org/fop/2.1/fonts.html#autodetect), fonts
listing fails with this exception:

org.apache.fop.cli.Main startFOP
GRAVE: Exception
java.lang.IllegalArgumentException: URI is not hierarchical
    at java.io.File.<init>(File.java:418)
    at org.apache.fop.fonts.FontCache.addFont(FontCache.java:335)
    at
org.apache.fop.fonts.autodetect.FontInfoFinder.getFontInfoFromCustomFont(FontInfoFinder.java:157)
    at
org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:269)
    at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63)
    at
org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:110)
    at
org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229)
    at
org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82)
    at
org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
    at
org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
    at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
    at
org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
    at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75)
    at
org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
    at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
    at
org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:350)
    at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
    at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
    at org.apache.fop.apps.Fop.<init>(Fop.java:78)
    at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:107)
    at org.apache.fop.cli.Main.startFOP(Main.java:186)
    at org.apache.fop.cli.Main.main(Main.java:217)

I found a way around this by using a custom resolver that will discard
any "jar: ..." URI.

I use fonts in a jar file for them to be taken into account by JEuclid
(I didn't find any other way so far).

I finally made this work by duplicating the fonts in the jar file in a
regular folder (so I must maintain 2 copies of each file).

I'm using FOP 2.1 (from
https://xmlgraphics.apache.org/fop/download.html) under Ubuntu 14.04 LTS
Linux.

BR,

-- 
-- 
*NeoDoc*
*Maxime Bégnis*
[email protected]
Tél: +33 (0)4.42.52.24.20
789 Rue de La Gare
13770 Venelles
France
http://www.neodoc.fr/
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.