[OpenJDK 2D-Dev] [PATCH] FontManager refactoring

Igor Nekrestyanov Igor.Nekrestyanov at Sun.COM
Sat Oct 18 08:36:38 UTC 2008


Wow, that's the large one. It will take some time for me to look through 
this
and Phil is the right guy to review most of these changes anyway.

Just few small comments for now.

I see that in number of places static variables are upper case. E.g. 
number of variables in the FontUtilities.
I am not sure if detailed naming and code conventions for OpenJDK were 
published but
usually we use upper case names for constants only. See
  http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367
While i have my own concerns to our codestyle i strongly believe that we 
should try to keep code style the same
in the whole workspaces. Obviously there are exceptions.

Comments like:

/**
* For backward compatibilty only, this will to be removed soon, don't use
* in new code.
*/

are way more helpful if they mention what to use instead.
(btw, you may want to fix spelling of "compatibilty")

-igor

Roman Kennke wrote:
> Hi,
>
> 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
> as follows:
>
> - 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
> plain FontManager.
> - 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
> there.
> - 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
> environment.
> - 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
> anyway).
> - 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
> head.
>
> The webrev for this is here:
>
> http://kennke.org/~roman/fontmanager/webrev/
>
> 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...
>
> Cheers, Roman
>   




More information about the 2d-dev mailing list