[OpenJDK 2D-Dev] Font question

Igor Nekrestyanov Igor.Nekrestyanov at Sun.COM
Thu Apr 17 09:42:49 UTC 2008


Looking at your screenshot again i started to doubt it is because of 
outlines - i do not see any dropouts
and these are common if geometric code does scan conversion.

What style of font is it? Is it plain or bold?
We do change processing logic for styled text (request outline, style it 
and then scan convert) and
it may have bugs.
How prototype looks on your system running your clean openjdk build?

Can you prototype run Font2DTest?
Will be interesting to compare to openjdk in for couple of different 
fonts/sizes and rasterization modes.

-igor


Roman Kennke wrote:
> 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
>
>   




More information about the 2d-dev mailing list