From owner-freebsd-gnome@FreeBSD.ORG Mon Mar 31 10:04:22 2003 Return-Path: Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B89637B401 for ; Mon, 31 Mar 2003 10:04:22 -0800 (PST) Received: from h132-197-179-51.gte.com (h132-197-179-51.gte.com [132.197.179.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1806F43F3F for ; Mon, 31 Mar 2003 10:04:21 -0800 (PST) (envelope-from ak03@gte.com) Received: from ork.gte.com (hkrncdzim34nghny@localhost [127.0.0.1]) h2VI4JCb018224 for ; Mon, 31 Mar 2003 13:04:20 -0500 (EST) (envelope-from ak03@ork.gte.com) Received: (from ak03@localhost) by ork.gte.com (8.12.8/8.12.8/Submit) id h2VI4JDH018223 for gnome@FreeBSD.ORG; Mon, 31 Mar 2003 13:04:19 -0500 (EST) Date: Mon, 31 Mar 2003 13:04:19 -0500 From: "Alexander N. Kabaev" To: gnome@FreeBSD.ORG Message-ID: <20030331180419.GA18211@ork.gte.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i Subject: Mozilla with Xft crashes a lot: FIX X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2003 18:04:24 -0000 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;