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
Родитель e7bde3dd61
Коммит 63181e575e
2 изменённых файлов: 18 добавлений и 3 удалений

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

@ -53,7 +53,7 @@ nsFontMetricsMotif :: ~nsFontMetricsMotif()
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");
@ -80,7 +80,8 @@ NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIDeviceContext*
mFont = new nsFont(aFont);
mContext = aCX;
mFontHandle = nsnull;
mLangGroup = aLangGroup;
firstFace.ToCString(wildstring, namelen);
if (abs(dpi - 75) < abs(dpi - 100))
@ -345,6 +346,17 @@ NS_IMETHODIMP nsFontMetricsMotif :: GetFontHandle(nsFontHandle &aHandle)
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,
nsString& aFontFace)

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

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