[OpenJDK 2D-Dev] [PATCH] FontManager refactoring
roman.kennke at aicas.com
Fri Oct 17 13:45:21 UTC 2008
this is the big FontManager refactoring patch I already mentioned a
couple of times. It's primary purpose is to make the font implementation
more portable (or: portable at all), allowing alternative/derived
implementations to be plugged in. The general architecture breaks down
- FontManager: is now a relatively small interface. This is the part
that the AWT API classes (esp. java.awt.Font) talk to.
- FontManagerForSGE: A subinterface of FontManager.
SunGraphicsEnvironment uses this. If you implement a backend based on
SGE, then you also need to implement this. Otherwise you can go with
- SunFontManager: A base implementation of FontManager(ForSGE). This has
all the shared code, a lot of stuff that was previously in FontManager
has been moved there.
- X11FontManager, Win32FontManager: The platform specific stuff went
- FontManagerFactory: Creates FontManager instance according to a
property or default.
- SunGraphicsEnvironment: Almost all font-related code has been moved
out of this class.
- FontUtilities: A new utility class. A couple of things from
FontManager went there, i.e. logging, access tricks (get/setFont2D()),
OS determination and general shared stuff.
For the most part, this was only moving around code, without changing
functionality. However, in some places it was necessary or seemed useful
to change some things:
- in sunFont.c we can now call the real isDisplayLocal() on the graphics
- in TrueTypeFont, the handling of the channel pool has been improved.
Before, the cleanup-hook was only initialized when somebody called
Font.createFont(), now it gets initialized whenever a channel is added
to the pool. Is slightly cleaner than before (although I guess it
doesn't matter much, since modern OSes cleanup resources quite well
- the FontManager.usePlatformFontMetrics() for windows flag has been
removed. I don't know if this is feasible, but the comments seemed to
indicate that this was the plan anyway. Might break some obscure apps
that rely on buggy code.
These are all functional changes I can think of from the top off my
The webrev for this is here:
The raw patch can also be downloaded somewhere in the webrev.
I'd be happy to hear your comments soon. Note that I did only very basic
testing on Windows. It is hellish to setup a build on windows,
especially when you don't have the resources to buy the necessary
licenses... Would be nice if somebody could test the stuff on Windows a
bit more. I hope that this patch is feasible to be included in OpenJDK
mainline, or that we can make it so...
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
More information about the 2d-dev