comparison src/ftfont.c @ 101284:4c2b48d0a379

(ftfont_lookup_cache): Check the return value of FcFontList. (ftfont_list): Likewise.
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Jan 2009 12:07:32 +0000
parents e038c1a8307c
children 7f8b5730cfa5
comparison
equal deleted inserted replaced
101283:dc4bcae2bbbc 101284:4c2b48d0a379
308 308
309 pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, 309 pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename,
310 FC_INDEX, FcTypeInteger, index, NULL); 310 FC_INDEX, FcTypeInteger, index, NULL);
311 objset = FcObjectSetBuild (FC_CHARSET, NULL); 311 objset = FcObjectSetBuild (FC_CHARSET, NULL);
312 fontset = FcFontList (NULL, pat, objset); 312 fontset = FcFontList (NULL, pat, objset);
313 xassert (fontset && fontset->nfont > 0); 313 if (fontset && fontset->nfont > 0
314 if (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0, &charset) 314 && (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0,
315 == FcResultMatch) 315 &charset)
316 == FcResultMatch))
316 cache_data->fc_charset = FcCharSetCopy (charset); 317 cache_data->fc_charset = FcCharSetCopy (charset);
317 else 318 else
318 cache_data->fc_charset = FcCharSetCreate (); 319 cache_data->fc_charset = FcCharSetCreate ();
319 FcFontSetDestroy (fontset); 320 FcFontSetDestroy (fontset);
320 FcObjectSetDestroy (objset); 321 FcObjectSetDestroy (objset);
833 { 834 {
834 FcPatternDel (pattern, FC_FAMILY); 835 FcPatternDel (pattern, FC_FAMILY);
835 FcPatternAddString (pattern, FC_FAMILY, fam); 836 FcPatternAddString (pattern, FC_FAMILY, fam);
836 FcFontSetDestroy (fontset); 837 FcFontSetDestroy (fontset);
837 fontset = FcFontList (NULL, pattern, objset); 838 fontset = FcFontList (NULL, pattern, objset);
838 if (fontset->nfont > 0) 839 if (fontset && fontset->nfont > 0)
839 break; 840 break;
840 } 841 }
841 } 842 }
842 } 843 }
843 #endif 844 #endif