From: handa Date: Fri, 3 Feb 2006 12:08:19 +0000 (+0000) Subject: (xlfd_parse_name): Fix handling of the name "nil". X-Git-Tag: REL-1-3-2~5 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=051688596a161b1da8f44a3b80ff2aa9a16cf83d;p=m17n%2Fm17n-lib.git (xlfd_parse_name): Fix handling of the name "nil". --- diff --git a/src/font.c b/src/font.c index 68594bd..6ab8c20 100644 --- a/src/font.c +++ b/src/font.c @@ -744,6 +744,7 @@ xlfd_parse_name (const char *name, MFont *font) char copy[513]; int i; char *p; + MSymbol sym; if (name[0] != '-') return -1; @@ -793,9 +794,19 @@ xlfd_parse_name (const char *name, MFont *font) size = atoi (field[XLFD_PIXEL]) * 10; if (field[XLFD_FOUNDRY]) - mfont__set_property (font, MFONT_FOUNDRY, msymbol (field[XLFD_FOUNDRY])); + { + sym = msymbol (field[XLFD_FOUNDRY]); + if (! sym) + sym = msymbol ("Nil"); + mfont__set_property (font, MFONT_FOUNDRY, sym); + } if (field[XLFD_FAMILY]) - mfont__set_property (font, MFONT_FAMILY, msymbol (field[XLFD_FAMILY])); + { + sym = msymbol (field[XLFD_FAMILY]); + if (! sym) + sym = msymbol ("Nil"); + mfont__set_property (font, MFONT_FAMILY, sym); + } if (field[XLFD_WEIGHT]) mfont__set_property (font, MFONT_WEIGHT, msymbol (field[XLFD_WEIGHT])); if (field[XLFD_SLANT]) @@ -2239,23 +2250,23 @@ mfont_copy (MFont *font) The mfont_get_prop () function gets the value of $KEY property of font $FONT. $KEY must be one of the following symbols: - @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c Madstyle, - @c Mregistry, @c Msize, @c Mresolution, @c Mspacing. + @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, + @c Madstyle, @c Mregistry, @c Msize, @c Mresolution, @c Mspacing. If $FONT is a return value of mfont_find (), $KEY can also be one of the following symbols: #Mfont_ascent, #Mfont_descent, #Mmax_advance. - @return If $KEY is @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, - @c Madstyle, @c Mregistry, or @c Mspacing, this function returns - the corresponding value as a symbol. If the font does not have - $KEY property, it returns @c Mnil. If $KEY is @c Msize, @c - Mresolution, #Mfont_ascent, Mfont_descent, or #Mmax_advance, this - function returns the corresponding value as an integer. If the - font does not have $KEY property, it returns 0. If $KEY is - something else, it returns @c NULL and assigns an error code to - the external variable #merror_code. */ + @return If $KEY is @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, + @c Mstretch, @c Madstyle, @c Mregistry, or @c Mspacing, this + function returns the corresponding value as a symbol. If the font + does not have $KEY property, it returns @c Mnil. If $KEY is @c + Msize, @c Mresolution, #Mfont_ascent, Mfont_descent, or + #Mmax_advance, this function returns the corresponding value as an + integer. If the font does not have $KEY property, it returns 0. + If $KEY is something else, it returns @c NULL and assigns an error + code to the external variable #merror_code. */ /***ja @brief ¥Õ¥©¥ó¥È¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÆÀ¤ë. @@ -2264,16 +2275,16 @@ mfont_copy (MFont *font) $KEY ¤Ç¤¢¤ë¤â¤Î¤ÎÃͤòÊÖ¤¹¡£$KEY ¤Ï°Ê²¼¤Î¥·¥ó¥Ü¥ë¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤±¤ì ¤Ð¤Ê¤é¤Ê¤¤¡£ - @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, + @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c Madstyle, @c Mregistry, @c Msize, @c Mresolution, @c Mspacing. - @return $KEY ¤¬ @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c - Madstyle, @c Mregistry, @c Mspacing ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ì¤Ð¡¢ÁêÅö¤¹¤ëÃÍ - ¤ò¥·¥ó¥Ü¥ë¤È¤·¤ÆÊÖ¤¹¡£¥Õ¥©¥ó¥È¤¬¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ò»ý¤¿¤Ê¤¤¾ì¹ç¤Ë¤Ï - @c Mnil ¤òÊÖ¤¹¡£$KEY ¤¬ @c Msize ¤¢¤ë¤¤¤Ï @c Mresolution ¤Î¾ì¹ç¤Ë¤Ï¡¢ - ÁêÅö¤¹¤ëÃͤò¤ÏÀ°¿ôÃͤȤ·¤ÆÊÖ¤¹¡£¥Õ¥©¥ó¥È¤¬¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ò»ý¤¿¤Ê¤¤ - ¾ì¹ç¤Ë¤Ï 0 ¤òÊÖ¤¹¡£$KEY ¤¬¤½¤ì°Ê³°¤Î¤â¤Î¤Ç¤¢¤ì¤Ð¡¢@c NULL ¤òÊÖ¤·¡¢ - ³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£ */ + @return $KEY ¤¬ @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c + Mstretch, @c Madstyle, @c Mregistry, @c Mspacing ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ì¤Ð¡¢ + ÁêÅö¤¹¤ëÃͤò¥·¥ó¥Ü¥ë¤È¤·¤ÆÊÖ¤¹¡£¥Õ¥©¥ó¥È¤¬¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ò»ý¤¿¤Ê¤¤ + ¾ì¹ç¤Ë¤Ï@c Mnil ¤òÊÖ¤¹¡£$KEY ¤¬ @c Msize ¤¢¤ë¤¤¤Ï @c Mresolution ¤Î + ¾ì¹ç¤Ë¤Ï¡¢ÁêÅö¤¹¤ëÃͤò¤ÏÀ°¿ôÃͤȤ·¤ÆÊÖ¤¹¡£¥Õ¥©¥ó¥È¤¬¤½¤Î¥×¥í¥Ñ¥Æ¥£ + ¤ò»ý¤¿¤Ê¤¤¾ì¹ç¤Ë¤Ï 0 ¤òÊÖ¤¹¡£$KEY ¤¬¤½¤ì°Ê³°¤Î¤â¤Î¤Ç¤¢¤ì¤Ð¡¢@c + NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£ */ void * mfont_get_prop (MFont *font, MSymbol key) @@ -2334,22 +2345,26 @@ mfont_get_prop (MFont *font, MSymbol key) $KEY and value is $VAL to font $FONT. $KEY must be one of the following symbols: - @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, + @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c Madstyle, @c Mregistry, @c Msize, @c Mresolution. If $KEY is @c Msize or @c Mresolution, $VAL must be an integer. - Otherwise, $VAL must be a symbol. */ + Otherwise, $VAL must be a symbol of a property value name. But, + if the name is "nil", a symbol of name "Nil" must be + specified. */ /***ja @brief ¥Õ¥©¥ó¥È¤Î¥×¥í¥Ñ¥Æ¥£¤ËÃͤòÀßÄꤹ¤ë. - ´Ø¿ô mfont_put_prop () ¤Ï¡¢¥Õ¥©¥ó¥È $FONT ¤Î¥­¡¼¤¬$KEY - ¤Ç¤¢¤ë¥×¥í¥Ñ¥Æ¥£¤ÎÃͤò $VAL ¤ËÀßÄꤹ¤ë¡£$KEY ¤Ï°Ê²¼¤Î¥·¥ó¥Ü¥ë¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£ + ´Ø¿ô mfont_put_prop () ¤Ï¡¢¥Õ¥©¥ó¥È $FONT ¤Î¥­¡¼¤¬$KEY ¤Ç¤¢¤ë¥×¥í¥Ñ + ¥Æ¥£¤ÎÃͤò $VAL ¤ËÀßÄꤹ¤ë¡£$KEY ¤Ï°Ê²¼¤Î¥·¥ó¥Ü¥ë¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£ - @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, + @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch, @c Madstyle, @c Mregistry, @c Msize, @c Mresolution. - $KEY ¤¬ @c Msize ¤« @c Mresolution ¤Ç¤¢¤ì¤Ð $VAL - ¤ÏÀ°¿ôÃͤǤʤ¯¤Æ¤Ï¤é¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¾ì¹ç¡¢$VAL ¤Ï¥·¥ó¥Ü¥ë¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£*/ + $KEY ¤¬ @c Msize ¤« @c Mresolution ¤Ç¤¢¤ì¤Ð $VAL ¤ÏÀ°¿ôÃͤǤʤ¯¤Æ¤Ï + ¤é¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¾ì¹ç¡¢$VAL ¤Ï¥×¥í¥Ñ¥Æ¥£ÃͤÎ̾Á°¤Î¥·¥ó¥Ü¥ë¤Ç¤Ê¤¯¤Æ + ¤Ï¤Ê¤é¤Ê¤¤¡£¤¿¤À¤·¤â¤·¤½¤Î̾Á°¤¬ "nil" ¤Î¾ì¹ç¤Ï¡¢Ì¾Á°¤¬ "Nil" ¤Î¥· + ¥ó¥Ü¥ë¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£*/ int mfont_put_prop (MFont *font, MSymbol key, void *val)