diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c index 0d88defc57..3dca35935a 100644 --- a/win32ss/gdi/gdi32/objects/font.c +++ b/win32ss/gdi/gdi32/objects/font.c @@ -2153,8 +2153,27 @@ GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0 }; + /* Determine the current font's Pitch and Family to save for later */ + LOGFONT lfnew; + LOGFONT* lf = &lfnew; + HFONT hlf; + INT ret; + BYTE FntPitchAndFamily = 0; + + hlf =(HFONT) GetCurrentObject(hdc,OBJ_FONT); + ret = GetObject(hlf, sizeof(LOGFONT), lf); + if (ret) + FntPitchAndFamily = lfnew.lfPitchAndFamily; + + /* This function currently in ReactOS will always return a Truetype font */ + /* because we cannot yet handle raster fonts. So it will return flags */ + /* TMPF_VECTOR and TMPF_TRUETYPE, which can cause problems in edit boxes */ if(!GetTextMetricsW(hdc, &tm)) return 0; + /* To compensate for the GetTextMetricsW call changing the PitchAndFont */ + /* we copy our stored value back into this field to restore the old value */ + tm.tmPitchAndFamily = FntPitchAndFamily; + if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0; if (lptm) *lptm = tm;