Added IsFontScaleable method

This commit is contained in:
rods%netscape.com 1999-05-18 13:46:49 +00:00
parent df0af65e2d
commit f0ff878dfb
3 changed files with 30 additions and 2 deletions

View File

@ -31,14 +31,16 @@ class nsString;
class nsIFontRetrieverService : public nsISupports
// This (singleton) service exists soley as a factory to manufacture iterators
{
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_IFONTRETRIEVERSERVICE_IID; return iid; }
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator ) = 0;
NS_IMETHOD CreateFontSizeIterator( const nsString * aFontName, nsIFontSizeIterator** aIterator ) = 0;
};
NS_IMETHOD IsFontScalable( const nsString * aFontName, PRBool* aResult ) = 0;
};
#endif

View File

@ -163,6 +163,7 @@ NS_IMETHODIMP nsFontRetrieverService::Advance()
return NS_ERROR_FAILURE;
}
//----------------------------------------------------------
static int CALLBACK MyEnumFontFamProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRIC FAR *lpntm,
unsigned long fontType,
@ -320,3 +321,26 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList()
return NS_OK;
}
//----------------------------------------------------------
NS_IMETHODIMP nsFontRetrieverService::IsFontScalable( const nsString * aFontName, PRBool* aResult )
{
PRBool found = PR_FALSE;
Reset();
do {
nsAutoString name;
Get(&name);
if (name.Equals(*aFontName)) {
found = PR_TRUE;
break;
}
} while (Advance() == NS_OK);
if (found) {
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
*aResult = fontInfo->mIsScalable;
return NS_OK;
}
return NS_ERROR_FAILURE;
}

View File

@ -38,6 +38,8 @@ public:
NS_IMETHOD CreateFontSizeIterator( const nsString * aFontName, nsIFontSizeIterator** aIterator );
NS_IMETHOD IsFontScalable( const nsString * aFontName, PRBool* aResult );
// nsIFontNameIterator
NS_IMETHOD Reset();