[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [06/12] gdi32: Perform the world transform separately from
From:       Michael Karcher <wine () mkarcher ! dialup ! fu-berlin ! de>
Date:       2008-06-30 11:28:44
Message-ID: 1214825324.4600.40.camel () hermes2 ! karcher ! local
[Download RAW message or body]

Am Dienstag, den 24.06.2008, 16:11 +0900 schrieb Dmitry Timoshkov:
> +    /* World transform */
> +    if (!is_identity_FMAT2(&font->font_desc.matrix))
> +    {
> +        FT_Matrix worldMat;
> +        worldMat.xx = FT_FixedFromFloat(font->font_desc.matrix.eM11);
> +        worldMat.xy = FT_FixedFromFloat(font->font_desc.matrix.eM21);
> +        worldMat.yx = FT_FixedFromFloat(font->font_desc.matrix.eM12);
> +        worldMat.yy = FT_FixedFromFloat(font->font_desc.matrix.eM22);
> +        pFT_Matrix_Multiply(&worldMat, &transMat);
> +        needsTransform = TRUE;
> +    }
> +
This causes a regression in the German computer-aided tax form printing
program "Elster-Formular". Previously, font scaling worked like in the
GM_COMPATIBLE graphics mode (set via SetGraphicsMode on the DC), that
is, mainly abs(yy) is used as scaling factor, and that's it. This change
introduces something like the GM_ADVANCED graphics mode, but does it
wrong (for example, the origin for reflections should be the point
specified in TextOut, currently, reflections are done relative to the
base line of the character; also the background is not reflected at
all). I have attached a simple test program to show what happens in wine
with a scaling that inverts the y axis (as the German tax program uses).
Its expected output would be to characters looking the same at the same
Y position, which is what I get in windows, and also with Wine 1.0.

If the GM_ADVANCED line is activated, expected output would be the first
"F" as is, and the second "F" upside down above the line, with the
lowest part of the white box touching the black line. No Wine version
does handle this case correctly.

Regards,
  Michael Karcher

["fontbug.c" (fontbug.c)]

#include <windows.h>

LRESULT CALLBACK wndproc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
{
    if(msg == WM_PAINT)
    {
        HDC dc;
        PAINTSTRUCT ps;
        HFONT fnt, oldfont;
        dc = BeginPaint(wnd, &ps);
        SetMapMode(dc, MM_ANISOTROPIC);
        /* SetGraphicsMode(dc, GM_ADVANCED);*/
        fnt = CreateFont(-20, 0, 0, 0, FW_MEDIUM,
                        FALSE, FALSE, FALSE, ANSI_CHARSET,
                        OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
                        DEFAULT_QUALITY, DEFAULT_PITCH, "Arial");
                        
        oldfont = SelectObject(dc, fnt);
        
        MoveToEx(dc,0,50, NULL);
        LineTo(dc,100, 50);
        
        TextOut(dc, 20, 50, "F", 1);

        SetWindowExtEx(dc, 800, 800, NULL);
        SetViewportExtEx(dc, 800, -800, NULL);
        
        
        SelectObject(dc, oldfont);
        SelectObject(dc, fnt);
        
        TextOut(dc, 50, -50, "F", 1);
        
        DeleteObject(SelectObject(dc, oldfont));
        
        EndPaint(wnd, &ps);
    }
    else if(msg == WM_DESTROY)
        PostQuitMessage(0);
    else
        DefWindowProc(wnd, msg, wp, lp);
}

int main(void)
{
    static WNDCLASS wc = {0};
    MSG msg;
    HWND mainwnd;
    wc.lpfnWndProc = wndproc;
    wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
    wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1);
    wc.lpszClassName = "sclfont";
    RegisterClass(&wc);
  
    mainwnd = CreateWindow("sclfont", "Font scaling test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                          CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, 0, 0, 0, 0);
  
    while(GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return 0;
}




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic