Font antialisng broken

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
dedoz
Newbie
Newbie
Posts: 3
Joined: Thu Sep 20, 2012 11:06 am

Font antialisng broken

Post by dedoz »

Font antialiasing in wine is now completely broken.
I did some research and this is what I've found:
In pre-1.5.13 only some of text objects were not correctly rendered: either they were fuzzy antialiased or not antialiased at all. See these bugs for an example
http://bugs.winehq.org/show_bug.cgi?id=15180
http://bugs.winehq.org/show_bug.cgi?id=29240
As of wine 1.5.13 all text is not antialiased at all(FIX: aa is actually only done to sizes >=14 and <=6). I'm not completely sure how wine used to draw windows and its content previously, but now, according to the changelog
Client-side window rendering is done using the DIB engine.
So, i checked out the sources and found this:
Issue1:
In file dlls/gdi32/font.c the function apparently responsible for deciding wether to do antialiasing or not is

Code: Select all

UINT get_font_aa_flags( HDC hdc )
One can notice that antialiasing is done(fuzzy but done) if function returns GGO_GRAY4_BITMAP, however everything breaks down here:

Code: Select all

if ( get_gasp_flags( hdc, &gasp_flags ) && !(gasp_flags & GASP_DOGRAY)){
        return GGO_BITMAP;
when get_gasp_flags returns true(flags have been read succcessfully) but GASP_DOGRAY flag in gasp_flags is not set.
get_gasp_flags is quite a complex function and printf-style debugging approach does not work here and i havent yet figured out how to debug wine itself with gdb to see what exactly happens there when antialiasing is not done. I suppose that either gasp table is not read correctly, or font size is not correctly converted from current DC and applied to table.
Issue2:
When get_font_aa_flags function is forced to return GGO_GRAY4_BITMAP antialiasing is done but it looks weird(see screenshot). I did some research and found out that antialiasing strength(?) is controlled via applying a ramp array from dlls/gdi32/graphics.c

Code: Select all

static const BYTE ramp[17] =
{
    0,    0x4d, 0x68, 0x7c,
    0x8c, 0x9a, 0xa7, 0xb2,
    0xbd, 0xc7, 0xd0, 0xd9,
    0xe1, 0xe9, 0xf0, 0xf8,
    0xff
};
which turns out to be samples from a logarithmic approximation. I then tried to change it to linear and it did show results similar to normal antialiasing(see screenshot), however text seems to have wrong approche.

I've noticed that font antialiasing problem does not really bother a lot of people out there but I really doubt that i am the only one who has it. It might not be that major compared to raw input and c++ runtime, although it's a rather annoying one at least for me.
Attachments
log ramp vs linear ramp
log ramp vs linear ramp
1.5.12 vs 1.5.13 AA
1.5.12 vs 1.5.13 AA
Locked