From: handa Date: Tue, 13 Dec 2005 00:51:31 +0000 (+0000) Subject: (xfont_open): Check resize ratio. X-Git-Tag: REL-1-3-0~22 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a6ac882b57726681c6ba60e3390900c4c4f12eaf;p=m17n%2Fm17n-lib.git (xfont_open): Check resize ratio. (xft_open): Likewise. --- diff --git a/src/m17n-X.c b/src/m17n-X.c index 4b184fd..83df642 100644 --- a/src/m17n-X.c +++ b/src/m17n-X.c @@ -624,7 +624,7 @@ close_xfont (void *object) static MRealizedFont * xfont_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) { - int size = spec->size; + int size; MRealizedFontX *x_rfont; char *name; Display *display = FRAME_DISPLAY (frame); @@ -632,6 +632,18 @@ xfont_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) int mdebug_mask = MDEBUG_FONT; MFont this; + if (font->size) + /* non-scalable font */ + size = font->size; + else if (spec->size) + { + int ratio = mfont_resize_ratio (font); + + size = ratio == 100 ? spec->size : spec->size * ratio / 100; + } + else + size = 120; + if (rfont) { for (; rfont; rfont = rfont->next) @@ -1070,10 +1082,22 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) FT_Face ft_face; MRealizedFontXft *rfont_xft; FcBool anti_alias = FRAME_DEVICE (frame)->depth > 1 ? FcTrue : FcFalse; - double size = font->size ? font->size : spec->size; + int size; XftFont *xft_font; int ascent, descent, max_advance, average_width, baseline_offset; + if (font->size) + /* non-scalable font */ + size = font->size; + else if (spec->size) + { + int ratio = mfont_resize_ratio (font); + + size = ratio == 100 ? spec->size : spec->size * ratio / 100; + } + else + size = 120; + if (rfont) { MRealizedFont *save = NULL; @@ -1115,6 +1139,7 @@ xft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) M17N_OBJECT_REF (rfont->info); MSTRUCT_CALLOC (rfont, MERROR_FONT_X); rfont->spec = *spec; + rfont->spec.size = size; rfont->frame = frame; rfont->font = font; rfont->driver = &xft_driver;