[OpenJDK 2D-Dev] Font question
Igor.Nekrestyanov at Sun.COM
Thu Apr 17 09:12:43 UTC 2008
>>> 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
>> 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.
There is no support to enable/disable hinting in runtime by hints or
However, in your case it seems you might be actually using unhinted
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.
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.
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.
More information about the 2d-dev