Mercurial > emacs
comparison src/xterm.c @ 59206:77ba45776c58
(x_new_font): Set FRAME_COLUMN_WIDTH to
fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to
fontp-?space_width..
(x_load_font): Calculate fontp->space_width and
fontp->average_width.
(x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 30 Dec 2004 12:26:31 +0000 |
parents | 0395e55b4aa7 |
children | b7ebbcf3b120 |
comparison
equal
deleted
inserted
replaced
59205:d33c176effbf | 59206:77ba45776c58 |
---|---|
7836 | 7836 |
7837 FRAME_FONT (f) = (XFontStruct *) (fontp->font); | 7837 FRAME_FONT (f) = (XFontStruct *) (fontp->font); |
7838 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; | 7838 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; |
7839 FRAME_FONTSET (f) = -1; | 7839 FRAME_FONTSET (f) = -1; |
7840 | 7840 |
7841 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); | 7841 FRAME_COLUMN_WIDTH (f) = fontp->average_width; |
7842 FRAME_SPACE_WIDTH (f) = fontp->space_width; | |
7842 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); | 7843 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); |
7843 | 7844 |
7844 compute_fringe_widths (f, 1); | 7845 compute_fringe_widths (f, 1); |
7845 | 7846 |
7846 /* Compute the scroll bar width in character columns. */ | 7847 /* Compute the scroll bar width in character columns. */ |
9779 bzero (fontp, sizeof (*fontp)); | 9780 bzero (fontp, sizeof (*fontp)); |
9780 fontp->font = font; | 9781 fontp->font = font; |
9781 fontp->font_idx = i; | 9782 fontp->font_idx = i; |
9782 fontp->name = (char *) xmalloc (strlen (fontname) + 1); | 9783 fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
9783 bcopy (fontname, fontp->name, strlen (fontname) + 1); | 9784 bcopy (fontname, fontp->name, strlen (fontname) + 1); |
9785 | |
9786 if (font->min_bounds.width == font->max_bounds.width) | |
9787 { | |
9788 /* Fixed width font. */ | |
9789 fontp->average_width = fontp->space_width = font->min_bounds.width; | |
9790 } | |
9791 else | |
9792 { | |
9793 XChar2b char2b; | |
9794 XCharStruct *pcm; | |
9795 | |
9796 char2b.byte1 = 0x00, char2b.byte2 = 0x20; | |
9797 pcm = x_per_char_metric (font, &char2b, 0); | |
9798 if (pcm) | |
9799 fontp->space_width = pcm->width; | |
9800 else | |
9801 fontp->space_width = FONT_WIDTH (font); | |
9802 | |
9803 fontp->average_width | |
9804 = (XGetFontProperty (font, dpyinfo->Xatom_AVERAGE_WIDTH, &value) | |
9805 ? (long) value / 10 : 0); | |
9806 if (fontp->average_width < 0) | |
9807 fontp->average_width = - fontp->average_width; | |
9808 if (fontp->average_width == 0) | |
9809 { | |
9810 if (pcm) | |
9811 { | |
9812 int width = pcm->width; | |
9813 for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) | |
9814 if ((pcm = x_per_char_metric (font, &char2b, 0)) != NULL) | |
9815 width += pcm->width; | |
9816 fontp->average_width = width / 95; | |
9817 } | |
9818 else | |
9819 fontp->average_width = FONT_WIDTH (font); | |
9820 } | |
9821 } | |
9784 | 9822 |
9785 /* Try to get the full name of FONT. Put it in FULL_NAME. */ | 9823 /* Try to get the full name of FONT. Put it in FULL_NAME. */ |
9786 full_name = 0; | 9824 full_name = 0; |
9787 if (XGetFontProperty (font, XA_FONT, &value)) | 9825 if (XGetFontProperty (font, XA_FONT, &value)) |
9788 { | 9826 { |
10407 dpyinfo->Xatom_ATOM_PAIR | 10445 dpyinfo->Xatom_ATOM_PAIR |
10408 = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); | 10446 = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); |
10409 /* For properties of font. */ | 10447 /* For properties of font. */ |
10410 dpyinfo->Xatom_PIXEL_SIZE | 10448 dpyinfo->Xatom_PIXEL_SIZE |
10411 = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); | 10449 = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); |
10450 dpyinfo->Xatom_AVERAGE_WIDTH | |
10451 = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); | |
10412 dpyinfo->Xatom_MULE_BASELINE_OFFSET | 10452 dpyinfo->Xatom_MULE_BASELINE_OFFSET |
10413 = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); | 10453 = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); |
10414 dpyinfo->Xatom_MULE_RELATIVE_COMPOSE | 10454 dpyinfo->Xatom_MULE_RELATIVE_COMPOSE |
10415 = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); | 10455 = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); |
10416 dpyinfo->Xatom_MULE_DEFAULT_ASCENT | 10456 dpyinfo->Xatom_MULE_DEFAULT_ASCENT |