From 1868273e769fc760d46721d97c79958856bb2949 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 30 Apr 2002 01:29:14 +0000 Subject: [PATCH] xlib complains a lot about fonts with '*' in the XLFD string. Bug 136743, patch by Roland.Mainz@informatik.med.uni-giessen.de (Roland Mainz), r=bstell, sr=attinasi --- gfx/src/gtk/nsFontMetricsGTK.cpp | 6 +++++- gfx/src/xlib/nsFontMetricsXlib.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gfx/src/gtk/nsFontMetricsGTK.cpp b/gfx/src/gtk/nsFontMetricsGTK.cpp index 79b856e0a4e1..2775e26cea83 100644 --- a/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -3744,7 +3744,11 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes) char name[256]; /* X11 font names are never larger than 255 chars */ strcpy(name, list[i]); - if ((!name) || (name[0] != '-')) { + /* Check if we can handle the font name ('*' and '?' are only valid in + * input patterns passed as argument to |XListFont()|&co. but _not_ in + * font names returned by these functions (see bug 136743 ("xlib complains + * a lot about fonts with '*' in the XLFD string"))) */ + if ((!name) || (name[0] != '-') || (PL_strpbrk(name, "*?") != nsnull)) { continue; } diff --git a/gfx/src/xlib/nsFontMetricsXlib.cpp b/gfx/src/xlib/nsFontMetricsXlib.cpp index 688fb85df5ab..d2eef692003d 100644 --- a/gfx/src/xlib/nsFontMetricsXlib.cpp +++ b/gfx/src/xlib/nsFontMetricsXlib.cpp @@ -4045,7 +4045,11 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib* aNod for (int i = 0; i < count; i++) { char name[256]; /* X11 font names are never larger than 255 chars */ - if ((!list[i]) || (list[i][0] != '-')) { + /* Check if we can handle the font name ('*' and '?' are only valid in + * input patterns passed as argument to |XListFont()|&co. but _not_ in + * font names returned by these functions (see bug 136743 ("xlib complains + * a lot about fonts with '*' in the XLFD string"))) */ + if ((!list[i]) || (list[i][0] != '-') || (PL_strpbrk(list[i], "*?") != nsnull)) { continue; }