summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2008-07-14 07:44:46 +0000
committerKenichi Handa <handa@m17n.org>2008-07-14 07:44:46 +0000
commitc782d5f3f2348bdeef52d6d8259cfc7918d3e492 (patch)
treec7e04d1fcccd62f8defb40768478a19dac99d1fb
parent4cb6cd72d03751db6b4596d49e7cc915f16d4c06 (diff)
downloademacs-c782d5f3f2348bdeef52d6d8259cfc7918d3e492.tar.gz
(xfont_open): Add workaround for X's bug.
-rw-r--r--src/xfont.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/xfont.c b/src/xfont.c
index 544088bce36..83a8c770f86 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -540,6 +540,35 @@ xfont_open (f, entity, pixel_size)
x_clear_errors (display);
xfont = NULL;
}
+ else if (! xfont)
+ {
+ /* Some version of X lists:
+ -misc-fixed-medium-r-normal--20-*-75-75-c-100-iso8859-1
+ -misc-fixed-medium-r-normal--20-*-100-100-c-100-iso8859-1
+ but can open only:
+ -misc-fixed-medium-r-normal--20-*-100-100-c-100-iso8859-1
+ and
+ -misc-fixed-medium-r-normal--20-*-*-*-c-100-iso8859-1
+ So, we try again with wildcards in RESX and RESY. */
+ Lisp_Object temp;
+
+ temp = Fcopy_font_spec (entity);
+ ASET (temp, FONT_DPI_INDEX, Qnil);
+ len = font_unparse_xlfd (temp, pixel_size, name, 256);
+ if (len <= 0)
+ {
+ font_add_log (" x:unparse failed", temp, Qnil);
+ return Qnil;
+ }
+ xfont = XLoadQueryFont (display, name);
+ if (x_had_errors_p (display))
+ {
+ /* This error is perhaps due to insufficient memory on X server.
+ Let's just ignore it. */
+ x_clear_errors (display);
+ xfont = NULL;
+ }
+ }
fullname = Qnil;
/* Try to get the full name of FONT. */
if (xfont && XGetFontProperty (xfont, XA_FONT, &value))