changeset 59407:b0b469611a56

* macterm.c (XLoadQueryFont): Correctly handle 0 size font widths that are returned from some Japanese fonts.
author Steven Tamm <steventamm@mac.com>
date Fri, 07 Jan 2005 07:11:24 +0000
parents cf93431040c9
children 59e7d7c60403
files src/ChangeLog src/macterm.c
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jan 07 06:16:20 2005 +0000
+++ b/src/ChangeLog	Fri Jan 07 07:11:24 2005 +0000
@@ -1,3 +1,8 @@
+2005-01-06  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (XLoadQueryFont): Correctly handle 0 size
+	font widths that are returned from some Japanese fonts.
+
 2005-01-06  Kim F. Storm  <storm@cua.dk>
 
 	* fringe.c (fringe_faces): Change to Lisp_Object pointer.
--- a/src/macterm.c	Fri Jan 07 06:16:20 2005 +0000
+++ b/src/macterm.c	Fri Jan 07 07:11:24 2005 +0000
@@ -6715,14 +6715,19 @@
 	    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);