From 1fc8198626f60ef824c103679aa40d3b3a46ef83 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 22 Sep 2005 07:20:15 +0000 Subject: [PATCH] (mface__realize): Set rface->average_width. (mface__update_frame_face): Set frame->average_width. --- src/face.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/face.c b/src/face.c index db7c807..e8cd66a 100644 --- a/src/face.c +++ b/src/face.c @@ -724,6 +724,20 @@ mface__realize (MFrame *frame, MFace **faces, int num, int size, MFont *font) } else rface->space_width = rfont->spec.size / 10; + if (rfont->average_width) + rface->average_width = rfont->average_width; + else + { + work_gstring.glyphs[0].code + = mfont__encode_char (frame, (MFont *) rfont, NULL, 'x'); + if (work_gstring.glyphs[0].code != MCHAR_INVALID_CODE) + { + mfont__get_metric (&work_gstring, 0, 1); + rface->average_width = work_gstring.glyphs[0].width; + } + else + rface->average_width = rface->space_width; + } } else { @@ -857,6 +871,7 @@ mface__update_frame_face (MFrame *frame) frame->rface = NULL; frame->rface = mface__realize (frame, NULL, 0, 0, NULL); frame->space_width = frame->rface->space_width; + frame->average_width = frame->rface->average_width; frame->ascent = frame->rface->ascent; frame->descent = frame->rface->descent; } -- 1.7.10.4