]> git.eshelyaron.com Git - emacs.git/commitdiff
(w32font_open_internal): Fill min_width with tmAveCharWidth.
authorJason Rumney <jasonr@gnu.org>
Tue, 5 Feb 2008 21:51:14 +0000 (21:51 +0000)
committerJason Rumney <jasonr@gnu.org>
Tue, 5 Feb 2008 21:51:14 +0000 (21:51 +0000)
Set smallest_font_height and smallest_char_width in display info.

src/ChangeLog
src/w32font.c

index 5f9547f6a75b8a7a574f1d51773f9c09c4570d3a..a322a3ad73559252deaa06fe35dfd3f203a3557d 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-05  Jason Rumney  <jasonr@gnu.org>
+
+       * w32font.c (w32font_open_internal): Fill min_width with tmAveCharWidth.
+       Set smallest_font_height and smallest_char_width in display info.
+
 2008-02-05  Kenichi Handa  <handa@ni.aist.go.jp>
 
        * coding.c (decode_eol): Pay attention to coding->dst_multibyte.
index b0e6b250a909131e99f5cac098d0393e11c045ec..ddb2f43eb57628333a78d5e64ea88c3ab313c82c 100644 (file)
@@ -724,11 +724,41 @@ w32font_open_internal (f, font_entity, pixel_size, w32_font)
   font->file_name = NULL;
   font->encoding_charset = -1;
   font->repertory_charset = -1;
-  font->min_width = 0;
+  /* TODO: do we really want the minimum width here, which could be negative? */
+  font->min_width = font->font.space_width;
   font->ascent = w32_font->metrics.tmAscent;
   font->descent = w32_font->metrics.tmDescent;
   font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR;
 
+  /* Set global flag fonts_changed_p to non-zero if the font loaded
+     has a character with a smaller width than any other character
+     before, or if the font loaded has a smaller height than any other
+     font loaded before.  If this happens, it will make a glyph matrix
+     reallocation necessary.  */
+  {
+    struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
+    dpyinfo->n_fonts++;
+
+    if (dpyinfo->n_fonts == 1)
+      {
+        dpyinfo->smallest_font_height = font->font.height;
+        dpyinfo->smallest_char_width = font->min_width;
+      }
+    else
+      {
+        if (dpyinfo->smallest_font_height > font->font.height)
+          {
+            dpyinfo->smallest_font_height = font->font.height;
+            fonts_changed_p |= 1;
+          }
+        if (dpyinfo->smallest_char_width > font->min_width)
+          {
+            dpyinfo->smallest_char_width = font->min_width;
+            fonts_changed_p |= 1;
+          }
+      }
+  }
+
   return 1;
 }