]> code.delx.au - gnu-emacs/commitdiff
* macterm.c (XLoadQueryFont): Correctly handle 0 size
authorSteven Tamm <steventamm@mac.com>
Fri, 7 Jan 2005 07:11:24 +0000 (07:11 +0000)
committerSteven Tamm <steventamm@mac.com>
Fri, 7 Jan 2005 07:11:24 +0000 (07:11 +0000)
font widths that are returned from some Japanese fonts.

src/ChangeLog
src/macterm.c

index 7b8e2a320ebd398c0236c04bea8e915cf45823ca..38317b9e8f69819dd857a1134f202ea22be9c3a4 100644 (file)
@@ -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.
index 4d80fbac5fa5029d0b450e2ef973b169591b551b..566f0c5b04b2fe2dc32b489135c61f771adb8bf1 100644 (file)
@@ -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);