diff options
| author | Kenichi Handa | 2004-12-30 12:26:31 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-12-30 12:26:31 +0000 |
| commit | 6875d1ae8cdb7993849ba380cdeb9ed8cd542c74 (patch) | |
| tree | d2fa5d8fe4ad506d61f76a5bd48013006ab782c4 /src | |
| parent | 7335e61a83e1b1e27d2eecf74f38e75a1674326d (diff) | |
| download | emacs-6875d1ae8cdb7993849ba380cdeb9ed8cd542c74.tar.gz emacs-6875d1ae8cdb7993849ba380cdeb9ed8cd542c74.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c index 0f78ba66efa..eb546746485 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7838,7 +7838,8 @@ x_new_font (f, fontname) | |||
| 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); |
| @@ -9782,6 +9783,43 @@ x_load_font (f, fontname, size) | |||
| 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); |
| 9784 | 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 | } | ||
| 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)) |
| @@ -10409,6 +10447,8 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 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 |