Fallback to non-fontconfig behaviour when fontconfig initialization fails.

Also fixes a memleak in that case, bug #1313.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27875 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-11-02 09:57:22 +00:00
parent bce49a37d4
commit 1ae7149c08
1 changed files with 3 additions and 5 deletions

View File

@ -407,10 +407,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con
if (!fc) { if (!fc) {
mp_msg(MSGT_ASS, MSGL_WARN, mp_msg(MSGT_ASS, MSGL_WARN,
MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed); MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
priv->config = NULL; goto exit;
priv->path_default = strdup(path);
priv->index_default = 0;
return priv;
} }
rc = FcInit(); rc = FcInit();
@ -419,7 +416,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con
priv->config = FcConfigGetCurrent(); priv->config = FcConfigGetCurrent();
if (!priv->config) { if (!priv->config) {
mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed); mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed);
return 0; goto exit;
} }
for (i = 0; i < library->num_fontdata; ++i) for (i = 0; i < library->num_fontdata; ++i)
@ -468,6 +465,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con
} }
priv->family_default = family ? strdup(family) : 0; priv->family_default = family ? strdup(family) : 0;
exit:
priv->path_default = path ? strdup(path) : 0; priv->path_default = path ? strdup(path) : 0;
priv->index_default = 0; priv->index_default = 0;