Re: Batik leaking temp files

2005-02-17 Thread Måns Rullgård
Thomas DeWeese [EMAIL PROTECTED] writes:

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

FYI, I upgraded to JDK 1.5, and now the problem seems to be gone.

-- 
Måns Rullgård
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik leaking temp files

2005-02-16 Thread Thomas DeWeese
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]


Re: Batik leaking temp files

2005-02-16 Thread Måns Rullgård
Thomas DeWeese [EMAIL PROTECTED] writes:

 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?

As a file in the same directory as my CSS file, and a @font-face
directive naming the font and file.

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

Maybe I should try the latest JVM version, though I'm always a bit on
cautious side when it comes to upgrading the JVM.  Is batik known to
work with Java 1.5?  I'm using 1.4 right now.

 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.

I could always give it a try.  Do I still specify the font in the same
way?

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

Thanks, but I really don't have the time to start hacking Batik right
now.  The speed isn't terribly important, since I'm anyway caching the
rasterized versions.

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

And of course it requires registration...  Oh well, I'll do it anyway.

-- 
Måns Rullgård
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik leaking temp files

2005-02-16 Thread Thomas DeWeese
Måns Rullgård wrote:
Thomas DeWeese [EMAIL PROTECTED] writes:

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.

I could always give it a try.  Do I still specify the font in the same
way?
   Pretty much except you need to include a fragment identifier for
the SVG font element.  There is a fairly complete example in
samples/tests/spec/fonts/fontFace.svg.
 One example is:
@font-face { font-family: CSS Batik SVGFont;
 src: url(batikFont.svg#Batik); }
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).
And of course it requires registration...  Oh well, I'll do it anyway.
   Thanks!
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]