From 0587b486872bed0821f9b7f15ab527a93464db6b Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Fri, 25 Feb 2000 23:06:40 +0000 Subject: [PATCH] Implement nsFontMetric gfx changes for motif. Vain attempt to fix bug #22266. --- gfx/src/motif/nsFontMetricsMotif.cpp | 16 ++++++++++++++-- gfx/src/motif/nsFontMetricsMotif.h | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gfx/src/motif/nsFontMetricsMotif.cpp b/gfx/src/motif/nsFontMetricsMotif.cpp index 01df512d438..e039bd167a8 100644 --- a/gfx/src/motif/nsFontMetricsMotif.cpp +++ b/gfx/src/motif/nsFontMetricsMotif.cpp @@ -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) diff --git a/gfx/src/motif/nsFontMetricsMotif.h b/gfx/src/motif/nsFontMetricsMotif.h index 414eba6d93b..cf4caea2148 100644 --- a/gfx/src/motif/nsFontMetricsMotif.h +++ b/gfx/src/motif/nsFontMetricsMotif.h @@ -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 mLangGroup; XFontStruct *mFontInfo; Font mFontHandle; nscoord mCharWidths[256];