Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19532

Allow extensions to contribute fonts to be used by FOP in PDF export

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 14.1
    • Old Core - PDF export
    • None
    • Unknown

    Description

      In XWIKI-12877, font auto detection was disabled because "the initial goal was to only load what is in WEB-INF/fonts and we don't really need anything else by default.".

      However, disabling auto-detect also prevents us from bringing new fonts from an extension and the only solution is to manually drop a file in the filesystem:

      FOP will also auto-detect fonts which are available in the classpath,
       if they are described as "application/x-font" in the MANIFEST.MF file. 
      For example, if your .jar file contains font/myfont.ttf:
      
      Manifest-Version: 1.0
      
          Name: font/myfont.ttf
          Content-Type: application/x-font
      
      This feature allows you to create JAR files containing fonts. The JAR
       files can be added to fop by providem them in the classpath, e.g. 
      copying them into the lib/ directory.
      

      https://xmlgraphics.apache.org/fop/2.7/fonts.html#autodetect

      It is not clear why loading the system fonts was a bad thing in the first place. Was it using too much RAM? Not being the original goal is not really a good reason.

      It should be possible to write an extension that has a custom manifest that would make it visible to FOP. I am not sure about the classpath visibility level (EM classpath vs container/lib classpath). I have not tested this, but it would be a really nice improvement if it works, IMO, since manipulating the filesystem is not really nice (specially on a hosted deployment, where you don't have much control).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              enygma Eduard Moraru
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: