PATCH: XGraphicsConfiguration implement font metrics cache
Scott Gilbertson
scottg@mantatest.com
Thu Jan 16 20:56:00 GMT 2003
I came accross a comment that said "FIXME: do caching", so I did. I see a
couple of possible problems with this patch, though:
1. it assumes that visual.getScreen().getDisplay() always returns the same
value
2. if you use many different fonts, the cache will just keep growing
My guess is that #1 is a valid assumption. Regarding #2, I considered using
weak references, but that would risk having fonts taken out of the cache
immediately before they're needed again, so I decided against it.
To test it, I ran my application which uses Graphics.setFont in a lot of the
paint functions, and confirmed that a few different fonts show up properly.
I also noticed a large speed improvement when painting a lot of text fields.
Index: libjava/ChangeLog
from Scott Gilbertson <scottg@mantatest.com>
* XGraphicsConfiguration.getXFontMetrics: implemented cache to improve
performance
patch is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20030116_FontCache.patch
Type: application/octet-stream
Size: 3085 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030116/680613b4/attachment.obj>
More information about the Java-patches
mailing list