commit: Fix cursor weirdness in windows.

From: Martin Sevior (msevior@seviorpc.ph.unimelb.edu.au)
Date: Wed Sep 10 2003 - 21:27:10 EDT

  • Next message: Martin Sevior: "commit: More win graphics class fixes."

    CVS:
    ----------------------------------------------------------------------
    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS:
    CVS: Committing in .
    CVS:
    CVS: Modified Files:
    CVS: win/gr_Win32Graphics.cpp
    CVS:
    ----------------------------------------------------------------------
    Fix the cursor weirdness on Win32.

    This was fixed by the following code...

                            UT_sint32 iwidth = 0;
                            UT_sint32 iadvance = 0;
                            UT_sint32 inextAdvance = 0;
                            for (i = 0, j = 0; i < iLengthOrig; i++)
                            {
                                    if(! (pChars[iCharOffset+i] == 0x200B || pChars[iCharOffset+i] ==
    0xFEFF
                                       /*|| pChars[iCharOffset+i] == UCS_LIGATURE_PLACEHOLDER*/ ) )
                                    {
                                            iwidth += pCharWidths[i];
                                            inextAdvance = tdu(iwidth);
                                            pCharAdvances[j] = inextAdvance - iadvance;
                                            iadvance = inextAdvance;
                                            j++;
                                    }
    .............

    Previously we just had

    pCharAdvances[j] = tdu(pCharWidths[i]

    This allowed rounding errors on each conversion to accumulate. Doing
    things the other way means we correct at each step.

    Just as well I teach Computation Physics so I know about rounding errors
    in numerical calculations!

    I have more win fixes put I'll submit them as a patch in a few minutes.

    Cheers

    Martin



    This archive was generated by hypermail 2.1.4 : Wed Sep 10 2003 - 20:38:23 EDT