From 35513d25a2e37a795afe530d51fa7a91a54174a1 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 13 Aug 2004 11:29:56 +0000 Subject: [PATCH] (mfont__init): Initialize Mx, Mfreetype, and Mxft. (Mx, Mfreetype): Declare here. (Mxft): New variable. (mfont_resize_ratio): New function. --- src/font.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/font.c b/src/font.c index 6d42b47..2bda328 100644 --- a/src/font.c +++ b/src/font.c @@ -821,6 +821,10 @@ mfont__init () Mfontconfig = msymbol ("fontconfig"); + Mx = msymbol ("x"); + Mfreetype = msymbol ("freetype"); + Mxft = msymbol ("xft"); + /* The first entry of each mfont__property_table must be Mnil so that actual properties get positive numeric numbers. */ for (i = 0; i <= MFONT_REGISTRY; i++) @@ -1428,6 +1432,33 @@ MSymbol Mresolution; MSymbol Mfontconfig; +/***en + @brief Symbol of name "x". + + The variable #Mx is to be used for a value of member of the + structure #MDrawGlyph to specify the type of member is + actually (XFontStruct *). */ + +MSymbol Mx; + +/***en + @brief Symbol of name "freetype". + + The variable #Mfreetype is to be used for a value of member + of the structure #MDrawGlyph to specify the type of member + is actually FT_Face. */ + +MSymbol Mfreetype; + +/***en + @brief Symbol of name "xft". + + The variable #Mxft is to be used for a value of member of the + structure #MDrawGlyph to specify the type of member + is actually (XftFont *). */ + +MSymbol Mxft; + /*=*/ /*** @} */ /*=*/ @@ -2026,6 +2057,35 @@ mfont_from_name (char *name) return mfont_parse_name (name, Mx); } +/*=*/ + +/***en + @brief Get resize information of a font. + + The mfont_resize_ratio () function lookups the m17n database + \ and returns a resizing ratio (in percentage) of + FONT. For instance, if the return value is 150, that means that + the m17n library uses an 1.5 time bigger font than a specified + size. */ + +/***ja + @brief ¥Õ¥©¥ó¥È¤Î¥ê¥µ¥¤¥º¾ðÊó¤òÆÀ¤ë + + ´Ø¿ô mfont_resize_ratio ¤Ï m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹ \ ¤ò¸¡ + º÷¤·¡¢¥Õ¥©¥ó¥È FONT ¤Î¥ê¥µ¥¤¥º¤ÎÈæΨ¡Ê¥Ñ¡¼¥»¥ó¥Æ¡¼¥¸¡Ë¤òÊÖ¤¹¡£Î㤨 + ¤ÐÊÖÃͤ¬ 150 ¤Ç¤¢¤ì¤Ð¡¢m17n ¥é¥¤¥Ö¥é¥ê¤Ï»ØÄꤵ¤ì¤¿¥µ¥¤¥º¤Î 1.5 ÇܤΠ+ ¥Õ¥©¥ó¥È¤ò»ÈÍѤ¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ */ + +int +mfont_resize_ratio (MFont *font) +{ + MFont request = *font; + + mfont__resize (font, &request); + return (font->property[MFONT_SIZE] * 100 / request.property[MFONT_SIZE]); +} + + /*** @} */ /*** @addtogroup m17nDebug */ -- 1.7.10.4