Date: Mon, 31 Mar 2003 13:04:19 -0500 From: "Alexander N. Kabaev" <ak03@gte.com> To: gnome@FreeBSD.ORG Subject: Mozilla with Xft crashes a lot: FIX Message-ID: <20030331180419.GA18211@ork.gte.com>
next in thread | raw e-mail | index | archive | help
Hello everyone, I had to patch mozilla in order to stop it from crashing every now and then trying to open various web sites. Apparently fontconfig is returning raster fonts for 'times' on my box sometimes and passing them to Xft is not a very good idea. Attached patch ignores non-Xft fonts and makes Mozilla much happier here :) -- Alexander Kabaev --- gfx/src/gtk/nsFontMetricsXft.cpp.orig Mon Mar 31 12:30:39 2003 +++ gfx/src/gtk/nsFontMetricsXft.cpp Mon Mar 31 12:30:58 2003 @@ -84,6 +84,7 @@ FcPattern *mPattern; FcPattern *mFontName; FcCharSet *mCharset; + int mNotXft; }; struct MozXftLangGroup { @@ -375,7 +376,7 @@ PRInt32 end = mLoadedFonts.Count(); for (PRInt32 j = 0; j < end; ++j) { font = (nsFontXft *)mLoadedFonts.ElementAt(j); - if (FcCharSetHasChar(font->mCharset, c)) { + if (FcCharSetHasChar(font->mCharset, c) && font->GetXftFont()) { currFont = font; goto FoundFont; // for speed -- avoid "if" statement } @@ -635,7 +636,7 @@ for (PRInt32 j = 0, end = mLoadedFonts.Count(); j < end; ++j) { font = (nsFontXft *)mLoadedFonts.ElementAt(j); - if (FcCharSetHasChar(font->mCharset, c)) { + if (FcCharSetHasChar(font->mCharset, c) && font->GetXftFont()) { currFont = font; goto FoundFont; // for speed -- avoid "if" statement } @@ -888,7 +889,7 @@ // font in our loaded list that supports the character for (PRInt32 i = 0, end = mLoadedFonts.Count(); i < end; ++i) { nsFontXft *font = (nsFontXft *)mLoadedFonts.ElementAt(i); - if (FcCharSetHasChar(font->mCharset, aChar)) + if (FcCharSetHasChar(font->mCharset, aChar) && font->GetXftFont() != NULL) return font; } @@ -1051,7 +1052,7 @@ for (PRInt32 j = 0, end = mLoadedFonts.Count(); j < end; ++j) { font = (nsFontXft *)mLoadedFonts.ElementAt(j); - if (FcCharSetHasChar(font->mCharset, c)) { + if (FcCharSetHasChar(font->mCharset, c) && font->GetXftFont()) { currFont = font; goto FoundFont; // for speed -- avoid "if" statement } @@ -1461,6 +1462,7 @@ FcPatternReference(mFontName); mXftFont = nsnull; + mNotXft = 0; // set up our charset mCharset = nsnull; @@ -1487,14 +1489,16 @@ XftFont * nsFontXft::GetXftFont(void) { - if (!mXftFont) { + if (!mXftFont && !mNotXft) { FcPattern *pat = FcFontRenderPrepare(0, mPattern, mFontName); if (!pat) return nsnull; mXftFont = XftFontOpenPattern(GDK_DISPLAY(), pat); - if (!mXftFont) + if (!mXftFont) { FcPatternDestroy(pat); + mNotXft = 1; + } } return mXftFont;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030331180419.GA18211>