Changelog: windows/dialog: DIALOG_GetCharSizeFromDC Make the function behave as descibed Remark: For the 16 bit installer of MS Encarta 99 the size calculation still seems wrong. On my system -adobe-helvetica-medium-r-normal-*-11-*-100-100-p-*-iso10646-1 is choosen, which is to small. If I force -adobe-helvetica-medium-r-normal-*-14-*-100-100-p-*-iso10646-1 to be choosen, the whole dialog box has the same size than in vmware/osr2, but the font is noticable bigger. Bye Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de Free Software: If you contribute nothing, expect nothing -- Index: wine/windows/dialog.c =================================================================== RCS file: /home/wine/wine/windows/dialog.c,v retrieving revision 1.96 diff -u -r1.96 dialog.c --- wine/windows/dialog.c 6 Dec 2001 22:21:36 -0000 1.96 +++ wine/windows/dialog.c 14 Dec 2001 20:18:08 -0000 @@ -142,6 +142,7 @@ * * Latest: the X font driver will now compute a proper average width * so this code can be removed + * bon 011214: Is "can be removed" still true? */ static BOOL DIALOG_GetCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize ) { @@ -172,23 +173,21 @@ * how Microsoft's dialog creation code calculates the size * of the font */ - if (GetTextExtentPointA(hDC,szAvgChars,sizeof(szAvgChars),&total)) + if (GetTextExtentPointA(hDC,szAvgChars,strlen(szAvgChars),&total)) { /* round up */ - pSize->cx = ((2*total.cx/sizeof(szAvgChars)) + 1)/2; + pSize->cx = (total.cx+(strlen(szAvgChars)-1))/strlen(szAvgChars); Success = TRUE; } } else { + /* Use the text metrics */ Success = TRUE; } - /* Use the text metrics */ - TRACE("Using tm: %ldx%ld (dlg: %ld x %ld) (%s)\n", + TRACE("from font: %ldx%ld (using: %ld x %ld) (%s)\n", tm.tmAveCharWidth, tm.tmHeight, pSize->cx, pSize->cy, tm.tmPitchAndFamily & TMPF_FIXED_PITCH ? "variable" : "fixed"); - pSize->cx = tm.tmAveCharWidth; - pSize->cy = tm.tmHeight; } /* select the original font */ if (hFontPrev) SelectFont(hDC,hFontPrev);