[OpenJDK 2D-Dev] Font question

Roman Kennke roman.kennke at aicas.com
Thu Apr 17 09:23:03 UTC 2008


Hi Igor,

> >>> 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.
> >   
> Just to clarify.
> OpenJDK sources do not include FreeType. Only glue code to Freetype 
> library is included into JDK.
> I.e. if you build openjdk yourself it will use library you have compiled 
> (or have installed)
> and whether Freetype does hinting or autohinting depends on how that 
> library is compiled.

Ok thanks. So I'm using whatever is installed in Ubuntu, which is most
likely FreeType with autohinting, and the same that is used by the
default OpenJDK pipeline and everything else. Fine.

> However, in your case it seems you might be actually using unhinted 
> outlines.

My TextRenderer is a subclass of GlyphListPipe, as far as I understand,
this uses the rasterizer and not the outline. Is this correct? Also, I
added debug output to FreetypeFontScaler.getGlyphOutline() and related
methods, and they are _not_ called.

> I suspect that you might be requesting shapes from the rasterizer and 
> then use standard geometric
> scan conversion code to draw it. Shapes will be unhinted and geometric 
> code does not know
> anything about truetype scan conversion specifics. Results rarely look 
> good at small sizes.

That was my first suspicion too, but I don't think that is the case. See
above.

> Note that there is no (easy) way to get hinted outline from java2d 
> (neither using t2k nor freetype).
> This is because hinting is process of adjusting to particular font size 
> and resolution, and therefore
> it is always used only before scan conversion.

Understood.

> I suggest to check what is actually requested from rasterizer (e.g. by 
> instrumenting FreeType glue code)
> and make sure bitmaps you draw are coming from rasterizer.

I'll dig a bit deeper and see what goes on in the native code.

/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