changeset 91545:572ea0c7c071

(w32font_open_internal): Fill min_width with tmAveCharWidth. Set smallest_font_height and smallest_char_width in display info.
author Jason Rumney <jasonr@gnu.org>
date Tue, 05 Feb 2008 21:50:58 +0000
parents fe6ea4515601
children 7e1dcd3ed3ab
files src/w32font.c
diffstat 1 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32font.c	Tue Feb 05 21:17:26 2008 +0000
+++ b/src/w32font.c	Tue Feb 05 21:50:58 2008 +0000
@@ -724,11 +724,41 @@
   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;
 }