justin,
i've been noticing this strange issue in the jesusonic editor (for a couple of years at least), where the cursor leaves a trail when moved. today i did a test in win32_curses to see if it is also present in there:
there was also something else. "m" and other characters were slightly cropped, which hinted of a possible GetTextMetrics problem...
it seems that GetTextMetrics when used with a font that has fdwQuality = DEFAULT_QUALITY, but ClearType is disabled, gives a result which is slightly off for tmAveCharWidth. using tmMaxCharWidth adds another pixel for this font size (and makes the letters more distant). subtracting one pixel from tmMaxCharWidth goes to the same cropped "m" issue.
i can see you compensate one pixel in the code, based on windows version, but this does not seem to work for the above case.
a solution, i guess, is to enabled/disable ClearType depending on windows version and also shift the position if needed:
Code:
DWORD quality;
if ((GetVersion()&0xFF) >= 6)
quality = CLEARTYPE_QUALITY;
else
quality = ANTIALISING_QUALITY;
...
CreateFont(..quality)
...
if ((GetVersion()&0xFF) >= 6) ++txpos;
a better one would be to check if ClearType is enabled:
Code:
UINT smoothing;
if ((GetVersion()&0xFF) >= 6)
if (SystemParametersInfo(0x200A, 0, &smoothing, 0)) {
// smoothing == 1 -> default
// smoothing == 2 -> cleartype
}
...
CreateFont(..DEFAULT_QUALITY)
...
if (smoothing == 2) ++txpos;
i'm not sending a patch since there are these different solutions and you can decide what's best.
cheers
--