summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-02 23:32:28 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-02 23:32:28 +0000
commitcbf77e3e9f46757c9a8c5c3e646d71a721ca7494 (patch)
treeb316fdd44dfc46e569c3339f3bb25c9d8d4ce128
parent9a20a76b069281725836e959e8c2eba922d04733 (diff)
downloadmpv-cbf77e3e9f46757c9a8c5c3e646d71a721ca7494.tar.bz2
mpv-cbf77e3e9f46757c9a8c5c3e646d71a721ca7494.tar.xz
Rewrite font family check in a simpler way.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26647 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libass/ass_fontconfig.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index be784ff6c5..f20f8d816c 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -67,7 +67,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold
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 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold
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);