From b3bcb8e120d1a15f258211e78346407e9a2b35d2 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Wed, 22 Jul 2009 22:49:55 +0200 Subject: Fallback to default fontconfig configuration If parsing or loading the fontconfig configuration file, either using the default or a specified one, fails, try to load the default fontconfig configuration. This triggers loading a fallback configuration if no configuration file is available at all. A warning message is emitted to notify the user about this. --- libass/ass_fontconfig.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index 4eee197..1201daa 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -453,12 +453,20 @@ fc_instance_t *fontconfig_init(ass_library_t *library, priv->config = FcConfigCreate(); rc = FcConfigParseAndLoad(priv->config, (unsigned char *) config, FcTrue); + if (!rc) { + ass_msg(library, MSGL_WARN, "No usable fontconfig configuration " + "file found, using fallback."); + FcConfigDestroy(priv->config); + priv->config = FcInitLoadConfig(); + rc++; + } if (rc && update) { FcConfigBuildFonts(priv->config); } if (!rc || !priv->config) { - ass_msg(library, MSGL_FATAL, "%s failed", "FcInitLoadConfigAndFonts"); + ass_msg(library, MSGL_FATAL, + "No valid fontconfig configuration found!"); FcConfigDestroy(priv->config); goto exit; } -- cgit v1.2.3