From 8b029254647487d30efdaa11037f5d000c0a5a31 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 22 Sep 2005 07:25:18 +0000 Subject: [PATCH] (MDisplayInfo): New member AVERAGE_WIDTH. (xfont_open): Set rfont->average_width. (xft_open): Likewise. (device_open): Initialize disp_info->AVERAGE_WIDTH. --- src/m17n-X.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/m17n-X.c b/src/m17n-X.c index f45473b..a09bc8b 100644 --- a/src/m17n-X.c +++ b/src/m17n-X.c @@ -106,6 +106,7 @@ typedef struct int hyper_mask; Atom MULE_BASELINE_OFFSET; + Atom AVERAGE_WIDTH; } MDisplayInfo; /* Anchor of the chain of MDisplayInfo objects. */ @@ -670,6 +671,9 @@ xfont_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) rfont->baseline_offset = (XGetFontProperty (xfont, disp_info->MULE_BASELINE_OFFSET, &value) ? (int) value : 0); + rfont->average_width + = (XGetFontProperty (xfont, disp_info->AVERAGE_WIDTH, &value) + ? (int) value / 10 : 0); } rfont->ascent = xfont->ascent + rfont->baseline_offset; rfont->descent = xfont->descent - rfont->baseline_offset; @@ -1058,7 +1062,7 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) FcBool anti_alias = FRAME_DEVICE (frame)->depth > 1 ? FcTrue : FcFalse; double size = font->size ? font->size : spec->size; XftFont *xft_font; - int ascent, descent, max_advance, baseline_offset; + int ascent, descent, max_advance, average_width, baseline_offset; if (rfont) { @@ -1083,6 +1087,7 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) ascent = rfont->ascent; descent = rfont->descent; max_advance = rfont->max_advance; + average_width = rfont->average_width; baseline_offset = rfont->baseline_offset; spec = &rfont->spec; ft_face = rfont->fontp; @@ -1107,6 +1112,7 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) rfont->ascent = ascent; rfont->descent = descent; rfont->max_advance = max_advance; + rfont->average_width = average_width; rfont->baseline_offset = baseline_offset; rfont->fontp = xft_font; rfont->next = MPLIST_VAL (frame->realized_font_list); @@ -2130,6 +2136,8 @@ device_open (MFrame *frame, MPlist *param) find_modifier_bits (disp_info); disp_info->MULE_BASELINE_OFFSET = XInternAtom (display, "_MULE_BASELINE_OFFSET", False); + disp_info->AVERAGE_WIDTH + = XInternAtom (display, "AVERAGE_WIDTH", False); mplist_add (display_info_list, Mt, disp_info); } -- 1.7.10.4