diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c index 0d88defc57..10ca8a7ef9 100644 --- a/win32ss/gdi/gdi32/objects/font.c +++ b/win32ss/gdi/gdi32/objects/font.c @@ -2153,7 +2153,41 @@ 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 }; +#if 1 /* This is a hack. See CORE-1091. */ + /* It is needed because ReactOS does not support raster fonts now */ + /* After Raster Font support is added, then it can be removed */ + /* Find the current font's logfont for testing its lf.lfFaceName */ + LOGFONT lf; + HFONT hCurrentFont; + + hCurrentFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT); + GetObject(hCurrentFont, sizeof(LOGFONT), &lf); + + /* 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 PitchAndFamily */ + /* to a Truetype one when we have a 'helv' font as our input we and (&) */ + /* our current PitchAndFamily with 0xF9 to remove the two problem bits */ + /* Out list below checks for Raster Font Facenames */ + DPRINT1("Font Facename is '%S'.\n", lf.lfFaceName); + if ((wcsicmp(lf.lfFaceName, L"Helv") == 0) || + (wcsicmp(lf.lfFaceName, L"Courier") == 0) || + (wcsicmp(lf.lfFaceName, L"MS Sans Serif") == 0) || + (wcsicmp(lf.lfFaceName, L"MS Serif") == 0) || + (wcsicmp(lf.lfFaceName, L"Times New Roman") == 0) || + (wcsicmp(lf.lfFaceName, L"MS Shell Dlg") == 0) || + (wcsicmp(lf.lfFaceName, L"System") == 0) || + (wcsicmp(lf.lfFaceName, L"Terminal") == 0)) + { + tm.tmPitchAndFamily = tm.tmPitchAndFamily & 0xF9; + } +#else if(!GetTextMetricsW(hdc, &tm)) return 0; +#endif if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;