Hi Måns,
Måns Rullgård wrote:
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.
Just curious how are you providing the font?
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. 1) Convert your TrueType font to an SVG font (using ttf2svg, which is part of the Batik toolkit). This might be slightly slower but most of our bottlenecks are not the font stuff. The real thing you will lose is font hinting, but the JDK doesn't do a great job with this right now anyways.
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).
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]