Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-528

Font file leakage, caching suggested

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Component/s: SVG Rasterizer
    • Labels:
      None
    • Environment:
      Operating System: Linux
      Platform: PC

      Description

      From batik-users mailing list:

      > I'm using Batik to dynamically generate and rasterize some graphics
      > from a tomcat servlet. I supply my own truetype font to make sure the
      > correct font gets used.
      >
      > The problem is that something, presumably Batik, is copying this font
      > file to a temporary file (in the tomcat temp directory), and fails to
      > remove it. Over time, I get hundreds of copies of the same file there
      > (with names like +~JF4554.tmp), and have to delete them manually.

      I'm fairly certain that it is not Batik, we use Font.createFont
      which takes an InputStream. I would suspect that this method is
      copying the file so it can use some sort of native library to read
      the font... Not that this helps you, I'm just "passing the buck" to
      the JVM

      > Am I doing something wrong? I am certain that I am not telling anyone
      > to do the copying, so I can't see how to make file go away when not
      > needed.

      I have two suggestions.
      [snip]
      2) Add a font cache similar to our Image cache into Batik.
      This way as long as the same URL was used each time for the font, you
      would only create one instance of the font. This would probably make
      a minor speed improvement. I could point out the places where changes
      would need to be made (I don't think this would be difficult).

      Even if you decide to go with #1 for now could you file a Bugzilla
      requesting #2 so it's not forgotten (I think it's a good idea).

        Attachments

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              mru@inprovide.com M
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: