Implement nsFontMetric gfx changes for motif. Vain attempt to fix bug #22266.

This commit is contained in:
cls%seawood.org 2000-02-25 23:06:40 +00:00
Родитель b40b550b5e
Коммит 0587b48687
2 изменённых файлов: 18 добавлений и 3 удалений

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

@ -53,7 +53,7 @@ nsFontMetricsMotif :: ~nsFontMetricsMotif()
NS_IMPL_ISUPPORTS(nsFontMetricsMotif, kIFontMetricsIID) NS_IMPL_ISUPPORTS(nsFontMetricsMotif, kIFontMetricsIID)
NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIDeviceContext* aCX) NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIAtom* aLangGroup, nsIDeviceContext* aContext)
{ {
NS_ASSERTION(!(nsnull == aCX), "attempt to init fontmetrics with null device context"); NS_ASSERTION(!(nsnull == aCX), "attempt to init fontmetrics with null device context");
@ -80,7 +80,8 @@ NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIDeviceContext*
mFont = new nsFont(aFont); mFont = new nsFont(aFont);
mContext = aCX; mContext = aCX;
mFontHandle = nsnull; mFontHandle = nsnull;
mLangGroup = aLangGroup;
firstFace.ToCString(wildstring, namelen); firstFace.ToCString(wildstring, namelen);
if (abs(dpi - 75) < abs(dpi - 100)) if (abs(dpi - 75) < abs(dpi - 100))
@ -345,6 +346,17 @@ NS_IMETHODIMP nsFontMetricsMotif :: GetFontHandle(nsFontHandle &aHandle)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsFontMetricsMotif :: GetLangGroup(nsIAtom** aLangGroup)
{
if (!aLangGroup) {
return NS_ERROR_NULL_POINTER;
}
*aLangGroup = mLangGroup;
NS_IF_ADDREF(*aLangGroup);
return NS_OK;
}
static void MapGenericFamilyToFont(const nsString& aGenericFamily, nsIDeviceContext* aDC, static void MapGenericFamilyToFont(const nsString& aGenericFamily, nsIDeviceContext* aDC,
nsString& aFontFace) nsString& aFontFace)

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

@ -42,7 +42,8 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD Init(const nsFont& aFont, nsIDeviceContext* aContext); NS_IMETHOD Init(const nsFont& aFont, nsIAtom* aLangGroup,
nsIDeviceContext* aContext);
NS_IMETHOD Destroy(); NS_IMETHOD Destroy();
NS_IMETHOD GetXHeight(nscoord& aResult); NS_IMETHOD GetXHeight(nscoord& aResult);
@ -59,6 +60,7 @@ public:
NS_IMETHOD GetFont(const nsFont*& aFont); NS_IMETHOD GetFont(const nsFont*& aFont);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle); NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
protected: protected:
void RealizeFont(); void RealizeFont();
@ -69,6 +71,7 @@ protected:
nsFont *mFont; nsFont *mFont;
nsIDeviceContext *mContext; nsIDeviceContext *mContext;
nsCOMPtr<nsIAtom> mLangGroup;
XFontStruct *mFontInfo; XFontStruct *mFontInfo;
Font mFontHandle; Font mFontHandle;
nscoord mCharWidths[256]; nscoord mCharWidths[256];