From 0045564abacbe78e4b07a34ff075928f1fd3492e Mon Sep 17 00:00:00 2001 From: "jshin%mailaps.org" Date: Mon, 12 May 2003 04:03:28 +0000 Subject: [PATCH] bug 196312 : work around a problem with CJK bi-width fonts and fontconfig prior to 2.2. (r/sr=blizzard). Not a part of the default build(Xft) --- gfx/src/gtk/nsFontMetricsXft.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gfx/src/gtk/nsFontMetricsXft.cpp b/gfx/src/gtk/nsFontMetricsXft.cpp index de96b24a074c..93f5d6bff211 100644 --- a/gfx/src/gtk/nsFontMetricsXft.cpp +++ b/gfx/src/gtk/nsFontMetricsXft.cpp @@ -1534,6 +1534,19 @@ nsFontXft::GetXftFont(void) if (!pat) return nsnull; + // bug 196312 : work around problem with CJK bi-width fonts + // and fontconfig prior to 2.2. CJK bi-width fonts are regarded + // as genuinely monospace by fontconfig that sets FC_SPACING + // to FC_MONOSPACE, which makes Xft drawing/measuring routines + // use the global advance width (the width of double width glyphs + // and twice the width of single width glyphs) even for single width + // characters (e.g. Latin letters and digits). This results in + // spaced-out ('s p a c e d - o u t') rendering. By deleting + // FC_SPACING here, we're emulating the behavior of fontconfig 2.2 or + // later that does not set FC_SPACING for any font. + if (FcGetVersion() < 20200) + FcPatternDel(pat, FC_SPACING); + mXftFont = XftFontOpenPattern(GDK_DISPLAY(), pat); if (!mXftFont) FcPatternDestroy(pat);