This commit is contained in:
michaelp%netscape.com 1998-08-01 21:36:05 +00:00
Родитель cdb0d32f69
Коммит bdfd1791d8
4 изменённых файлов: 29 добавлений и 0 удалений

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

@ -97,6 +97,8 @@ public:
PRInt32 aId,
nsIImage*& aImage);
NS_IMETHOD CheckFontExistence(const char * aFontName);
protected:
~nsDeviceContextUnix();
nsresult CreateFontCache();

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

@ -108,6 +108,7 @@ public:
PRInt32 aId,
nsIImage*& aImage) = 0;
NS_IMETHOD CheckFontExistence(const char * aFontName) = 0;
};
#endif /* nsIDeviceContext_h___ */

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

@ -59,4 +59,28 @@ nsDrawingSurface nsDeviceContextWin :: GetDrawingSurface(nsIRenderingContext &aC
return mSurface;
}
int CALLBACK fontcallback(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm,
int FontType, LPARAM lParam)
{
if (NULL != lpelf)
*((PRBool *)lParam) = PR_TRUE;
return 0;
}
NS_IMETHODIMP nsDeviceContextWin :: CheckFontExistence(const char * aFontName)
{
HWND hwnd = (HWND)GetNativeWidget();
HDC hdc = ::GetDC(hwnd);
PRBool isthere = PR_FALSE;
::EnumFontFamilies(hdc, aFontName, (FONTENUMPROC)fontcallback, (LPARAM)&isthere);
::ReleaseDC(hwnd, hdc);
if (PR_TRUE == isthere)
return NS_OK;
else
return NS_ERROR_FAILURE;
}

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

@ -36,6 +36,8 @@ public:
//in the device context for re-use.
virtual nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext);
NS_IMETHOD CheckFontExistence(const char * aFontName);
protected:
virtual ~nsDeviceContextWin();