aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Tamm <[email protected]>2005-01-07 07:11:24 +0000
committerSteven Tamm <[email protected]>2005-01-07 07:11:24 +0000
commita6fffcdcb75633c40d7af4c2a8cfcf513f34dd89 (patch)
treeca64c1f1e37f9caa214bb42b103086ca0494f446
parent112d84efad57869bf65e1ee002dadb0c42e40308 (diff)
* macterm.c (XLoadQueryFont): Correctly handle 0 size
font widths that are returned from some Japanese fonts.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/macterm.c13
2 files changed, 14 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7b8e2a320e..38317b9e8f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-06 YAMAMOTO Mitsuharu <[email protected]>
+
+ * macterm.c (XLoadQueryFont): Correctly handle 0 size
+ font widths that are returned from some Japanese fonts.
+
2005-01-06 Kim F. Storm <[email protected]>
* fringe.c (fringe_faces): Change to Lisp_Object pointer.
diff --git a/src/macterm.c b/src/macterm.c
index 4d80fbac5f..566f0c5b04 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -6715,14 +6715,19 @@ XLoadQueryFont (Display *dpy, char *fontname)
char_width = CharWidth (c);
font->per_char[c - 0x20].width = char_width;
font->per_char[c - 0x20].rbearing = char_width;
- min_width = min (min_width, char_width);
- max_width = max (max_width, char_width);
- }
+ /* Some Japanese fonts (in SJIS encoding) return 0 as the
+ character width of 0x7f. */
+ if (char_width > 0)
+ {
+ min_width = min (min_width, char_width);
+ max_width = max (max_width, char_width);
+ }
+ }
font->min_bounds.width = min_width;
font->max_bounds.width = max_width;
}
}
-
+
TextFont (old_fontnum); /* restore previous font number, size and face */
TextSize (old_fontsize);
TextFace (old_fontface);