comparison src/w32font.c @ 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 e96ff7166c81
children 3081b8f848bc
comparison
equal deleted inserted replaced
91544:fe6ea4515601 91545:572ea0c7c071
722 font->driver = &w32font_driver; 722 font->driver = &w32font_driver;
723 font->format = Qgdi; 723 font->format = Qgdi;
724 font->file_name = NULL; 724 font->file_name = NULL;
725 font->encoding_charset = -1; 725 font->encoding_charset = -1;
726 font->repertory_charset = -1; 726 font->repertory_charset = -1;
727 font->min_width = 0; 727 /* TODO: do we really want the minimum width here, which could be negative? */
728 font->min_width = font->font.space_width;
728 font->ascent = w32_font->metrics.tmAscent; 729 font->ascent = w32_font->metrics.tmAscent;
729 font->descent = w32_font->metrics.tmDescent; 730 font->descent = w32_font->metrics.tmDescent;
730 font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR; 731 font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR;
732
733 /* Set global flag fonts_changed_p to non-zero if the font loaded
734 has a character with a smaller width than any other character
735 before, or if the font loaded has a smaller height than any other
736 font loaded before. If this happens, it will make a glyph matrix
737 reallocation necessary. */
738 {
739 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
740 dpyinfo->n_fonts++;
741
742 if (dpyinfo->n_fonts == 1)
743 {
744 dpyinfo->smallest_font_height = font->font.height;
745 dpyinfo->smallest_char_width = font->min_width;
746 }
747 else
748 {
749 if (dpyinfo->smallest_font_height > font->font.height)
750 {
751 dpyinfo->smallest_font_height = font->font.height;
752 fonts_changed_p |= 1;
753 }
754 if (dpyinfo->smallest_char_width > font->min_width)
755 {
756 dpyinfo->smallest_char_width = font->min_width;
757 fonts_changed_p |= 1;
758 }
759 }
760 }
731 761
732 return 1; 762 return 1;
733 } 763 }
734 764
735 /* Callback function for EnumFontFamiliesEx. 765 /* Callback function for EnumFontFamiliesEx.