[OpenJDK 2D-Dev] Font question

Roman Kennke roman.kennke at aicas.com
Thu Apr 17 08:46:11 UTC 2008


Hi Phil,

> > I have a problem related to fonts. As you might know, I'm hacking on the
> > OpenJDK challenge thing and try to implement an external toolkit/J2D
> > pipeline based on external and internal interfaces etc. Progress is
> > pretty good so far, as can be seen here:
> >
> > http://kennke.org/blog/2008/04/16/caciocavallo-prototype/
> >   
> 
> Is the text on that "Swing Activity Board" what we are supposed to be 
> looking at?

I suppose yes, depending on what you think you are supposed to be
looking at ;-) It is a straightforward little Swing application (kindof
the Classpath pendant to the SwingSet2 demo, only much smaller and less
demanding).

> > However, there seems to be a problem related to fonts. To me, it looks
> > like they are not hinted properly. My TextRenderer implementation is
> > very simple and straightforward:
> >   
> 
> The only control for font hinting is how the rasteriser - freetype - is 
> compiled.
> If your copy of libfreetype is built with hinting turned off, then that 
> will make a difference.

I did not change compilation of FreeType in OpenJDK. I am using the same
FreeType that is used when I choose the default AWT/J2D implementation,
and there it looks just fine.

> The usual compensation for that is antialiasing the text.

Yeah, I was thinking that too. But how do I get the rasterizer to give
me antialiased pixels? All I can see in my TextRenderer implementation
is 0 and 255 pixels, nothing between, even if I force the text AA
rendering hint to ON.

> Still that looks pretty grotty, maybe there's something more to it, like 
> a font that
> wasn't very amenable to auto-hinting, although it looks like a fairly 
> straightforward sans font,

I am using the FreeSans that ships with Ubuntu. When I show that in the
Gnome fonts viewer, using B+W, it doesn't look too good either, but
still much better than in my demo. Other fonts I tried (Bitstream Vera,
DejaVu and some more) looked even worse.

> I notice the text in the window manager title bar that presumably comes 
> from your desktop
> may be the same font and its greyscale and looks like it would also be 
> grotty in B&W.         

Possible. As I said, that FreeSans font doesn't look too good without AA
(as does none of the free fonts I suppose, because of the lack of
TrueType hinting in normal FreeType distributions). BTW: Is the FreeType
in OpenJDK compiled using the autohinter or using the (patented)
TrueType hinter?

Anything else I should have a look at?

Cheers, Roman

-- 
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-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




More information about the 2d-dev mailing list