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

[PATCH] Refactored configuration, font detection and caching, url resolution


    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: unqualified
    • Labels:
    • Environment:
      Operating System: other
      Platform: Other
    • External issue ID:


      This patch includes quite a few things (apologies for its size but in this case
      I felt it best to refactor before adding additional functionality). The only
      consolation is that it should take you less time to apply it than it took me to
      prepare it!

      Firstly it includes a refactoring of FOP configuration so FOP components no
      longer have a direct dependency on the deprecated avalon configuration framework
      (renderers no longer implement
      org.apache.avalon.framework.configuration.Configurable). Every component that
      requires configuration has an associated configuration class in
      org.apache.fop.config. Configuration is now achieved by simply calling
      FopConfig.configure(fopComponent) from the component (factory, renderers etc).

      Secondly it this patch includes some additional FOP configuration options which
      allow the user to define a font directory or to automatically detect fonts
      installed on the native operating system, the results of which can be cached for
      subsequent FOP executions. This should make font configuration much easier for
      the standard user.

      The patch also includes a rewrite of the resolve method in FOURIResolver and a
      general tightening up of the FOP configuration (including a renaming and an
      improvement in the unit tests).

      Here is an example FOP configuration file demostrating the new configuration
      options :-

      <!-- by default this option is set to true and is only present here to show its
      existence in the event that you may wish to turn off font caching -->

      <!-- you can specify where the cache file should be, but by default you
      shouldn't need to configure or worry about this, it will be set automatically
      for you-->

      <renderer mime="application/pdf">
      <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>

      <!-- any fonts found in this directory will be automatically added -->
      <directory recursive="true">C:\MyFonts</directory>

      <!-- your native o/s will be searched and any fonts found will be automatically
      added -->

      This new font configuration/caching functionality is excluded from the
      specialised AFP font configuration.
      Native font finding and font triplet info indentification may need to be tweaked
      but seems to work pretty well from my tests on the standard true type fonts
      included with windows.

      Other changes :-

      org.apache.fop.fonts.Font.BOLD renamed to org.apache.fop.fonts.Font.WEIGHT_BOLD
      org.apache.fop.fonts.Font.NORMAL renamed to org.apache.fop.fonts.Font.WEIGHT_NORMAL
      org.apache.fop.fonts.Font.STYLE_NORMAL added
      org.apache.fop.fonts.Font.STYLE_ITALIC added

      Please try the patch out, let me know if I have missed or broken anything,
      feedback is welcome .


        1. out.txt
          6 kB
          Adrian Cumiskey
        2. out.txt
          6 kB
          Adrian Cumiskey
        3. filelist.txt
          6 kB
          Adrian Cumiskey
        4. bug_41831.patch
          309 kB
          Adrian Cumiskey
        5. bug_41831.patch
          315 kB
          Adrian Cumiskey
        6. bug_41831.patch
          315 kB
          Adrian Cumiskey
        7. bug_41831.patch
          370 kB
          Adrian Cumiskey
        8. autodetect.zip
          10 kB
          Adrian Cumiskey
        9. autodetect.zip
          10 kB
          Adrian Cumiskey

          Issue Links



              • Assignee:
                fop-dev@xmlgraphics.apache.org fop-dev
                fop-dev@cumiskey.com Adrian Cumiskey
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: