зеркало из https://github.com/mozilla/gecko-dev.git
added font existence API.
This commit is contained in:
Родитель
cdb0d32f69
Коммит
bdfd1791d8
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче