Mercurial > mplayer.hg
comparison libass/ass_fontconfig.c @ 26615:75154771f2f3
Rewrite font family check in a simpler way.
author | eugeni |
---|---|
date | Fri, 02 May 2008 23:32:28 +0000 |
parents | 875a7878626c |
children | c37a85037fc2 |
comparison
equal
deleted
inserted
replaced
26614:875a7878626c | 26615:75154771f2f3 |
---|---|
65 { | 65 { |
66 FcBool rc; | 66 FcBool rc; |
67 FcResult result; | 67 FcResult result; |
68 FcPattern *pat = 0, *rpat; | 68 FcPattern *pat = 0, *rpat; |
69 int r_index; | 69 int r_index; |
70 FcChar8 *r_family, *r_style, *r_file; | 70 FcChar8 *r_family, *r_style, *r_file, *r_fullname; |
71 FcBool r_outline; | 71 FcBool r_outline; |
72 FcCharSet* r_charset; | 72 FcCharSet* r_charset; |
73 FcFontSet* fset = 0; | 73 FcFontSet* fset = 0; |
74 int curf; | 74 int curf; |
75 char* retval = 0; | 75 char* retval = 0; |
145 goto error; | 145 goto error; |
146 retval = strdup((const char*)r_file); | 146 retval = strdup((const char*)r_file); |
147 | 147 |
148 result = FcPatternGetString(rpat, FC_FAMILY, 0, &r_family); | 148 result = FcPatternGetString(rpat, FC_FAMILY, 0, &r_family); |
149 if (result != FcResultMatch) | 149 if (result != FcResultMatch) |
150 goto error; | 150 r_family = NULL; |
151 | 151 |
152 if (strcasecmp((const char*)r_family, family) != 0) { | 152 result = FcPatternGetString(rpat, FC_FULLNAME, 0, &r_fullname); |
153 result = FcPatternGetString(rpat, FC_FULLNAME, 0, &r_family); | 153 if (result != FcResultMatch) |
154 if (result != FcResultMatch || strcasecmp((const char*)r_family, family) != 0) | 154 r_fullname = NULL; |
155 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, | 155 |
156 (const char*)r_family, family); | 156 if (!(r_family && strcasecmp((const char*)r_family, family) == 0) && |
157 } | 157 !(r_fullname && strcasecmp((const char*)r_fullname, family) == 0)) |
158 | 158 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, |
159 (const char*)(r_family ? r_family : r_fullname), family); | |
159 error: | 160 error: |
160 if (pat) FcPatternDestroy(pat); | 161 if (pat) FcPatternDestroy(pat); |
161 if (fset) FcFontSetDestroy(fset); | 162 if (fset) FcFontSetDestroy(fset); |
162 return retval; | 163 return retval; |
163 } | 164 } |