Caciocavallo for the masses
September 24, 2008 1 Comment
Some exiting things happened during the last two weeks in the Caciocavallo project, namely two new AWT widgets based on swing, merging back patches from the Cacio branch to main JDK7 and more font refactoring work.
Mario Torre implemented two new widgets for Cacio’s AWT peers, namely the TextFieldPeer and a first prototype of the TextAreaPeer (minus the scrollbars: you guess it, that’s the tricky part). We’ll be posting screenshots soon.
I posted a couple of patches from the Cacio HG to the appropriate groups for review. One (the isDisplayLocal patch) is already in the J2D workspace, another one (AWT peers cleanup) is currently in review and another one (some RepaintManager fixlets) seems to be stuck somehow. /me bumbs the Swing-dev list. 😉
I also continued with The Big Font Refactoring in Caciocavallo. The plan is to enable replacing of the font implementation, which is currently not at all possible. The font subsystems basically has 3 ‘sides’: to AWT it shows a rather high-level view and basically cares about mapping Font objects (family name, size, style) to Font2D objects (which hook into the font subsystem for real) and handling the metrics. Then there is the rasterizer, which needs to get bitmasks or alpha masks of rasterized glyphs to render. And finally, of course, there is the actual font scaler/rasterizer implementation which is currently done by FreeType on OpenJDK. Most of the things that talk to AWT are currently done in the big mess that is the FontManager class, plus some bits in SunGraphicsEnvironment subclasses. The FontManager is a kitchen sink for all kinds of tasks, including Windows and Solaris specific handling, all ‘nicely’ munched in a big all-static utility class with no way of providing alternative implementations. In Caciocavallo, we refactored this into a FontManager interface with a corresponding factory, and moved all the platform specific stuff in platform specific implementations of this interface. This way it should be possible to provide an alternative implementation of mapping fonts to system specific resources and hooking into the Font2D system. I don’t think that I will provide an interface to the rasterizer though: I assume that the rasterizer and the font implementation should go hand in hand anyway, and know about each other somehow. (Update: Duh. Of course, there already is such an interface in OpenJDK, to support both FreeType and the old non-free thing in there.) I would like to use the 100% Java TrueType implementation of GNU Classpath as a proof-of-concept for all this work, but I’m not sure how to handle the legal stuff (this code was originally contributed to GNU Classpath by Sascha Brawer, and I don’t think I’ll ask him to sign the SCA and all that). Maybe I simply put that in my own repository outside of OpenJDK.