Mercurial > emacs
comparison src/ftfont.c @ 95433:3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 31 May 2008 02:27:46 +0000 |
parents | 9c54d4f00cf6 |
children | de4cb7ab40db |
comparison
equal
deleted
inserted
replaced
95432:e18e11dca65b | 95433:3ffecc48d809 |
---|---|
1705 | 1705 |
1706 Lisp_Object | 1706 Lisp_Object |
1707 ftfont_font_format (FcPattern *pattern) | 1707 ftfont_font_format (FcPattern *pattern) |
1708 { | 1708 { |
1709 FcChar8 *str; | 1709 FcChar8 *str; |
1710 int len; | |
1710 | 1711 |
1711 #ifdef FC_FONTFORMAT | 1712 #ifdef FC_FONTFORMAT |
1712 if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) | 1713 if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) |
1713 return Qnil; | 1714 return Qnil; |
1714 if (strcmp ((char *) str, "TrueType") == 0) | 1715 if (strcmp ((char *) str, "TrueType") == 0) |
1720 if (strcmp ((char *) str, "BDF") == 0) | 1721 if (strcmp ((char *) str, "BDF") == 0) |
1721 return intern ("bdf"); | 1722 return intern ("bdf"); |
1722 #else /* not FC_FONTFORMAT */ | 1723 #else /* not FC_FONTFORMAT */ |
1723 if (FcPatternGetString (pattern, FC_FILE, 0, &str) != FcResultMatch) | 1724 if (FcPatternGetString (pattern, FC_FILE, 0, &str) != FcResultMatch) |
1724 return Qnil; | 1725 return Qnil; |
1725 if (strcasestr ((char *) str, ".ttf") == 0) | 1726 len = strlen ((char *) str); |
1726 return intern ("truetype"); | 1727 if (len >= 4) |
1727 if (strcasestr ((char *) str, "pfb") == 0) | 1728 { |
1728 return intern ("type1"); | 1729 str += len - 4; |
1729 if (strcasestr ((char *) str, "pcf") == 0) | 1730 if (xstrcasecmp ((char *) str, ".ttf") == 0) |
1730 return intern ("pcf"); | 1731 return intern ("truetype"); |
1731 if (strcasestr ((char *) str, "bdf") == 0) | 1732 if (xstrcasecmp ((char *) str, "pfb") == 0) |
1732 return intern ("bdf"); | 1733 return intern ("type1"); |
1734 if (xstrcasecmp ((char *) str, "pcf") == 0) | |
1735 return intern ("pcf"); | |
1736 if (xstrcasecmp ((char *) str, "bdf") == 0) | |
1737 return intern ("bdf"); | |
1738 } | |
1733 #endif /* not FC_FONTFORMAT */ | 1739 #endif /* not FC_FONTFORMAT */ |
1734 return intern ("unknown"); | 1740 return intern ("unknown"); |
1735 } | 1741 } |
1736 | 1742 |
1737 | 1743 |