Re: What's the status of bug [Bug 5748] - Char widths are not properly calculated?]

From: Jordi Mas (jmas@softcatala.org)
Date: Sun Oct 05 2003 - 04:09:31 EDT

  • Next message: msevior@physics.unimelb.edu.au: "Re: What's the status of bug [Bug 5748] - Char widths are not properly calculated?]"

    > The character Widths and heights should be exactly the same for for the
    > same run no matter what the zoom is. That is the secret of the new layout
    > engine.
    >
    > The minus thing should go in anyway. It prolly helps get the font right. I
    > suspect that Windows will always screwup at 25% zoom because it appears to
    > be trying to "fix" the insane small font size requests we send it at that
    > very small zoom.

    1. I do think that there is a problem with Windows GDI. I believe that when
    you work with big font sizes (that's what we do currently) in a DC Windows do
    not always returns proper char widths or we lose precission somehow in the
    conversions.

    2. The only way that I make it working is applying the following patch, that's
    basically deactivating the new scaling code.

    3. With this patch the number of pages of the document when you zoom is not
    consistant.

    My personal opinion is to commit this patch. At least you can type and see
    that you type properly.

    Thanks,

    -- 
    

    Jordi Mas i Hernāndez (homepage http://www.softcatala.org/~jmas) http://www.softcatala.org

    Index: src/af/gr/win/gr_Win32CharWidths.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32CharWidths.cpp,v
    retrieving revision 1.25
    diff -u -r1.25 gr_Win32CharWidths.cpp
    --- src/af/gr/win/gr_Win32CharWidths.cpp 15 Sep 2003 19:40:01 -0000 1.25
    +++ src/af/gr/win/gr_Win32CharWidths.cpp 5 Oct 2003 08:18:13 -0000
    @@ -27,7 +27,9 @@
     #include "ut_endian.h"
     
     //////////////////////////////////////////////////////////////////
    -#if 1
    +#define NEW_SCALE 0
    +
    +#if NEW_SCALE
     
     #define _UL(x) (x)
     #define _UUL(x)(x) = (x)
    Index: src/af/gr/win/gr_Win32Graphics.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32Graphics.cpp,v
    retrieving revision 1.154.2.2
    diff -u -r1.154.2.2 gr_Win32Graphics.cpp
    --- src/af/gr/win/gr_Win32Graphics.cpp 18 Sep 2003 20:01:05 -0000 1.154.2.2
    +++ src/af/gr/win/gr_Win32Graphics.cpp 5 Oct 2003 08:18:15 -0000
    @@ -37,7 +37,7 @@
     #include "ut_Win32OS.h"
     
     #define WIN_SCALE_RATIO 1440.0/72.
    -#define NEW_SCALE 1
    +#define NEW_SCALE 0
     
     //#define GR_GRAPHICS_DEBUG 1
     
    @@ -1378,7 +1378,7 @@
     #if NEW_SCALE
             LOGFONT lf;
             int iRes = GetObject(m_hFont, sizeof(LOGFONT), &lf);
    - lf.lfHeight= static_cast<LONG>(static_cast<double>(m_iUnScaled)* WIN_SCALE_RATIO);
    + lf.lfHeight= - static_cast<LONG>(static_cast<double>(m_iUnScaled)* WIN_SCALE_RATIO);
             HFONT hFont = CreateFontIndirect(&lf);
             HDC hdc = CreateDC("DISPLAY",NULL,NULL,NULL);
             SelectObject(hdc,hFont);
    @@ -1416,7 +1416,7 @@
     #if NEW_SCALE
             LOGFONT lf;
             int iRes = GetObject(m_hFont, sizeof(LOGFONT), &lf);
    - lf.lfHeight = static_cast<LONG>(static_cast<double>(m_iUnScaled)* WIN_SCALE_RATIO);
    + lf.lfHeight = - static_cast<LONG>(static_cast<double>(m_iUnScaled)* WIN_SCALE_RATIO);
             HFONT hFont = CreateFontIndirect(&lf);
             HDC hdc = CreateDC("DISPLAY",NULL,NULL,NULL);
             SelectObject(hdc,hFont);



    This archive was generated by hypermail 2.1.4 : Sun Oct 05 2003 - 04:27:10 EDT