Change EnumFontFamilies() to EnumFontFamiliesEx() Bug 192342, Author=jdunn, r=smontagu, sr=kin.

This commit is contained in:
smontagu%netscape.com 2003-07-02 21:42:15 +00:00
Родитель 8944437d02
Коммит 7710966ba0
1 изменённых файлов: 8 добавлений и 11 удалений

Просмотреть файл

@ -594,20 +594,17 @@ NS_IMETHODIMP nsDeviceContextWin :: CheckFontExistence(const nsString& aFontName
HDC hdc = ::GetDC(hwnd);
PRBool isthere = PR_FALSE;
char fontName[LF_FACESIZE];
const PRUnichar* unicodefontname = aFontName.get();
int outlen = ::WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length(),
fontName, LF_FACESIZE, NULL, NULL);
if(outlen > 0)
fontName[outlen] = '\0'; // null terminate
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
logFont.lfPitchAndFamily = 0;
int outlen = WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
// somehow the WideCharToMultiByte failed, let's try the old code
if(0 == outlen)
aFontName.ToCString(fontName, LF_FACESIZE);
if(0 == outlen)
aFontName.ToCString(logFont.lfFaceName, LF_FACESIZE);
::EnumFontFamilies(hdc, fontName, (FONTENUMPROC)fontcallback, (LPARAM)&isthere);
::EnumFontFamiliesEx(hdc, &logFont, (FONTENUMPROC)fontcallback, (LPARAM)&isthere, 0);
::ReleaseDC(hwnd, hdc);