Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2611

Fonts in the class path makes fonts listing fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.1
    • None
    • font/unqualified
    • None

    Description

      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)

      Steps to reproduce:

      1. delete FOP's fonts cache (on Linux: "~/.fop/fop-fonts.cache")
      2. include a .jar file containing a font as described in https://xmlgraphics.apache.org/fop/2.1/fonts.html#autodetect
      in the FOP's class path
      3. run FOP

      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).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              maxbg Maxime Bégnis
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: