Mercurial > mplayer.hg
comparison libass/ass_fontconfig.c @ 27841:29d72a47da0c
Fallback to non-fontconfig behaviour when fontconfig initialization fails.
Also fixes a memleak in that case, bug #1313.
author | reimar |
---|---|
date | Sun, 02 Nov 2008 09:57:22 +0000 |
parents | 4876c89bafdd |
children | c03685299634 |
comparison
equal
deleted
inserted
replaced
27840:0073bd183787 | 27841:29d72a47da0c |
---|---|
405 int i; | 405 int i; |
406 | 406 |
407 if (!fc) { | 407 if (!fc) { |
408 mp_msg(MSGT_ASS, MSGL_WARN, | 408 mp_msg(MSGT_ASS, MSGL_WARN, |
409 MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed); | 409 MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed); |
410 priv->config = NULL; | 410 goto exit; |
411 priv->path_default = strdup(path); | |
412 priv->index_default = 0; | |
413 return priv; | |
414 } | 411 } |
415 | 412 |
416 rc = FcInit(); | 413 rc = FcInit(); |
417 assert(rc); | 414 assert(rc); |
418 | 415 |
419 priv->config = FcConfigGetCurrent(); | 416 priv->config = FcConfigGetCurrent(); |
420 if (!priv->config) { | 417 if (!priv->config) { |
421 mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed); | 418 mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed); |
422 return 0; | 419 goto exit; |
423 } | 420 } |
424 | 421 |
425 for (i = 0; i < library->num_fontdata; ++i) | 422 for (i = 0; i < library->num_fontdata; ++i) |
426 process_fontdata(priv, library, ftlibrary, i); | 423 process_fontdata(priv, library, ftlibrary, i); |
427 | 424 |
466 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcConfigAppFontAddDirFailed); | 463 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcConfigAppFontAddDirFailed); |
467 } | 464 } |
468 } | 465 } |
469 | 466 |
470 priv->family_default = family ? strdup(family) : 0; | 467 priv->family_default = family ? strdup(family) : 0; |
468 exit: | |
471 priv->path_default = path ? strdup(path) : 0; | 469 priv->path_default = path ? strdup(path) : 0; |
472 priv->index_default = 0; | 470 priv->index_default = 0; |
473 | 471 |
474 return priv; | 472 return priv; |
475 } | 473 } |