diff --git a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp index 4a183b840f7..be97552ab8a 100644 --- a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp +++ b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp @@ -436,7 +436,7 @@ NS_IMETHODIMP nsDeviceContextPh :: CheckFontExistence(const nsString& aFontName) if( fontName ) { - int MAX_FONTDETAIL = 30; + int MAX_FONTDETAIL = 90; FontDetails fDetails[MAX_FONTDETAIL]; int fontcount; diff --git a/mozilla/gfx/src/photon/nsFontMetricsPh.cpp b/mozilla/gfx/src/photon/nsFontMetricsPh.cpp index 6eb41e638cd..ec67d872cc8 100644 --- a/mozilla/gfx/src/photon/nsFontMetricsPh.cpp +++ b/mozilla/gfx/src/photon/nsFontMetricsPh.cpp @@ -141,7 +141,7 @@ nsFontMetricsPh :: Init ( const nsFont& aFont, nsIAtom* aLangGroup, char NSFontName[64]; /* Local buffer to keep the fontname in */ char NSFontSuffix[5]; - char NSFullFontName[64]; + char NSFullFontName[MAX_FONT_TAG]; NSFontSuffix[0] = nsnull; @@ -181,7 +181,8 @@ nsFontMetricsPh :: Init ( const nsFont& aFont, nsIAtom* aLangGroup, float f; mDeviceContext->GetDevUnitsToAppUnits(f); PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::Init with nsFont: Internal Name <%s> f=<%f>\n",fontInfo.font, f)); - mFontHandle = nsString( (const PRUnichar *) NSFullFontName, strlen(NSFullFontName)); + //mFontHandle = nsString( (const PRUnichar *) NSFullFontName, strlen(NSFullFontName)); + mFontHandle = strdup(NSFullFontName); /* memory leak */ /* These are in pixels and need to be converted! */ float height; @@ -317,6 +318,7 @@ NS_IMETHODIMP nsFontMetricsPh ::GetNormalLineHeight(nscoord &aHeight) { aHeight = mEmHeight + mLeading; + PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::GetNormalLineHeight aHeight=<%d>\n", aHeight)); return NS_OK; } @@ -379,7 +381,7 @@ nsFontMetricsPh :: GetMaxAdvance(nscoord &aAdvance) NS_IMETHODIMP nsFontMetricsPh :: GetFont(const nsFont *&aFont) { -// PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::GetFont\n")); + PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::GetFont\n")); aFont = mFont; return NS_OK; } @@ -401,9 +403,8 @@ NS_IMETHODIMP nsFontMetricsPh::GetLangGroup(nsIAtom** aLangGroup) NS_IMETHODIMP nsFontMetricsPh::GetFontHandle(nsFontHandle &aHandle) { -// PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::GetFontHandle\n")); - - aHandle = (nsFontHandle) &mFontHandle; + PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsFontMetricsPh::GetFontHandle mFontHandle=<%s>\n", mFontHandle)); + aHandle = (nsFontHandle) mFontHandle; return NS_OK; } diff --git a/mozilla/gfx/src/photon/nsFontMetricsPh.h b/mozilla/gfx/src/photon/nsFontMetricsPh.h index 196fe22622c..7b8d465d970 100644 --- a/mozilla/gfx/src/photon/nsFontMetricsPh.h +++ b/mozilla/gfx/src/photon/nsFontMetricsPh.h @@ -77,7 +77,7 @@ protected: nsDeviceContextPh *mDeviceContext; nsFont *mFont; - nsString mFontHandle; /* Photon Fonts are just a string */ + char *mFontHandle; /* Photon Fonts are just a string */ nscoord mHeight; nscoord mAscent; nscoord mDescent; diff --git a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp index 14d0a101232..ab97f10b1a7 100644 --- a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp +++ b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp @@ -782,7 +782,7 @@ NS_IMETHODIMP nsRenderingContextPh :: SetFont(nsIFontMetrics *aFontMetrics) //PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::SetFont with nsIFontMetrics mFontMetrics=<%p> aFontMetrics=<%p>\n", mFontMetrics, aFontMetrics)); nsFontHandle fontHandle; /* really a nsString */ - nsString *pFontHandle; + char *pFontHandle; NS_IF_RELEASE(mFontMetrics); mFontMetrics = aFontMetrics; @@ -792,20 +792,20 @@ NS_IMETHODIMP nsRenderingContextPh :: SetFont(nsIFontMetrics *aFontMetrics) return NS_OK; mFontMetrics->GetFontHandle(fontHandle); - pFontHandle = (nsString *) fontHandle; + pFontHandle = (char *) fontHandle; if (pFontHandle) { if( mPhotonFontName ) - delete [] mPhotonFontName; + free(mPhotonFontName); - mPhotonFontName = pFontHandle->ToNewCString(); + mPhotonFontName = strdup(pFontHandle); if (mPhotonFontName) - { + { /* Cache the Font metrics locally, costs ~1400 bytes per font */ PfLoadMetrics( mPhotonFontName ); - PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::SetFont with nsIFontMetrics Photon Font Name is <%s>\n", mPhotonFontName)); + PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::SetFont with nsIFontMetrics Photon Font Name is <%s> <%s>\n", mPhotonFontName, pFontHandle)); PgSetFont( mPhotonFontName ); }