From 04b65d2b577b25e8b0a5d31692a8b66a0b298d1f Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Tue, 5 Feb 2008 21:51:14 +0000 Subject: [PATCH] (w32font_open_internal): Fill min_width with tmAveCharWidth. Set smallest_font_height and smallest_char_width in display info. --- src/ChangeLog | 5 +++++ src/w32font.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5f9547f6a75..a322a3ad735 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-02-05 Jason Rumney + + * 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 * coding.c (decode_eol): Pay attention to coding->dst_multibyte. diff --git a/src/w32font.c b/src/w32font.c index b0e6b250a90..ddb2f43eb57 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -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; } -- 2.39.5