+2008-05-31 Kenichi Handa <handa@m17n.org>
+
+ * ftfont.c (ftfont_font_format): Don't use strcasestr.
+
2008-05-30 Stefan Monnier <monnier@iro.umontreal.ca>
* chartab.c (Foptimize_char_table, optimize_sub_char_table):
ftfont_font_format (FcPattern *pattern)
{
FcChar8 *str;
+ int len;
#ifdef FC_FONTFORMAT
if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch)
#else /* not FC_FONTFORMAT */
if (FcPatternGetString (pattern, FC_FILE, 0, &str) != FcResultMatch)
return Qnil;
- if (strcasestr ((char *) str, ".ttf") == 0)
- return intern ("truetype");
- if (strcasestr ((char *) str, "pfb") == 0)
- return intern ("type1");
- if (strcasestr ((char *) str, "pcf") == 0)
- return intern ("pcf");
- if (strcasestr ((char *) str, "bdf") == 0)
- return intern ("bdf");
+ len = strlen ((char *) str);
+ if (len >= 4)
+ {
+ str += len - 4;
+ if (xstrcasecmp ((char *) str, ".ttf") == 0)
+ return intern ("truetype");
+ if (xstrcasecmp ((char *) str, "pfb") == 0)
+ return intern ("type1");
+ if (xstrcasecmp ((char *) str, "pcf") == 0)
+ return intern ("pcf");
+ if (xstrcasecmp ((char *) str, "bdf") == 0)
+ return intern ("bdf");
+ }
#endif /* not FC_FONTFORMAT */
return intern ("unknown");
}