From: handa Date: Thu, 22 Sep 2005 07:25:18 +0000 (+0000) Subject: (MDisplayInfo): New member AVERAGE_WIDTH. X-Git-Tag: REL-1-3-0~152 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b029254647487d30efdaa11037f5d000c0a5a31;p=m17n%2Fm17n-lib.git (MDisplayInfo): New member AVERAGE_WIDTH. (xfont_open): Set rfont->average_width. (xft_open): Likewise. (device_open): Initialize disp_info->AVERAGE_WIDTH. --- 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); }