# HG changeset patch # User eugeni # Date 1209771148 0 # Node ID 75154771f2f355b86d9b36e39c6efabf6ccf0050 # Parent 875a7878626ca8d9898daf038eeb55ad10dc7b27 Rewrite font family check in a simpler way. diff -r 875a7878626c -r 75154771f2f3 libass/ass_fontconfig.c --- a/libass/ass_fontconfig.c Fri May 02 23:32:26 2008 +0000 +++ b/libass/ass_fontconfig.c Fri May 02 23:32:28 2008 +0000 @@ -67,7 +67,7 @@ FcResult result; FcPattern *pat = 0, *rpat; int r_index; - FcChar8 *r_family, *r_style, *r_file; + FcChar8 *r_family, *r_style, *r_file, *r_fullname; FcBool r_outline; FcCharSet* r_charset; FcFontSet* fset = 0; @@ -147,15 +147,16 @@ result = FcPatternGetString(rpat, FC_FAMILY, 0, &r_family); if (result != FcResultMatch) - goto error; + r_family = NULL; - if (strcasecmp((const char*)r_family, family) != 0) { - result = FcPatternGetString(rpat, FC_FULLNAME, 0, &r_family); - if (result != FcResultMatch || strcasecmp((const char*)r_family, family) != 0) - mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, - (const char*)r_family, family); - } + result = FcPatternGetString(rpat, FC_FULLNAME, 0, &r_fullname); + if (result != FcResultMatch) + r_fullname = NULL; + if (!(r_family && strcasecmp((const char*)r_family, family) == 0) && + !(r_fullname && strcasecmp((const char*)r_fullname, family) == 0)) + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, + (const char*)(r_family ? r_family : r_fullname), family); error: if (pat) FcPatternDestroy(pat); if (fset) FcFontSetDestroy(fset);