Font.createFont leaves files in temp directory

拜拜、爱过 提交于 2019-11-29 10:02:26

If your ttf files are not inside an archive, you can call createFont(File) instead of createFont(InputStream)

As to the best of my knowledge, this bug exists in Java 6, it is enough to look at the sources of Font class.

With JDK1.6.0_16, the font manager seem to be using the temporary file as a kind of cache and will only read glyphs from the font when they are required. It is also adding a shutdown hook, which will delete the file when the JVM terminates ordinarily. Depending on the VM, font rendering is perhaps also delegated to native code which needs access to the file, so keeping a lock on the file seems reasonable to me.

Are the files actually kept, even if your servlet container (you are mentioning a web application) terminates regularly, or are you killing it without allowing it to cleanup its resources properly?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!