Hi Phil and everybody, > > Ok, this makes sense now :-) Now I'm thinking that it's probably best to > > go back to the original implementation, except that it's in > > SunFontManager instead of FontManager. Do you agree? > > > > Yes.
Ok, I changed it back to the original behaviour. I still think it's not perfect. I'm coming from the point of view of implementing my own FontManager (this is what I'm doing!). Then I have TrueTypeFont depending on SunFontManager (well, not really depending on, but infact no cleanup if it's not). This is not cool. I have no quick solution to this, but here are some ideas: - Change the FontManager interface from createFont2D(File f, ...) to createFont2D(InputStream i,..), and let the font manager care about everything, including how to deal w/ the InputStream. For example, I'd prefer to read the whole file into memory (direct ByteBuffer) and use this as source for TrueTypeFont, because on the systems I'm working on I don't know if I have tmp space on disk. - Do the cleanup in a FontManager-independent way. The FontChannelPool was a start in right direction, but not so useful. And I don't have time right now to make it perfect. - Fix(?) File.deleteOnExit() so that any open channels on that file get closed before actually deleting the file. I don't know if it's considered a bug in File.deleteOnExit() if it fails when any channels are still open, I'd say yes, because cleaning up temporary files is what this API is made for. Should not be so difficult to implement. Just register all open channels w/ the file deletion hook, if there is one, and close them before deleting, just like we do in our hook. Anyway, here's the new webrev: http://kennke.org/~roman/fontmanager4/webrev/ And the zipped version: http://kennke.org/~roman/fontmanager4.zip Have fun! /Roman -- Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-48 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt