summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libass/ass_fontconfig.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index e97102b..d91dc6c 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -177,6 +177,17 @@ static char *get_fallback(void *priv, const char *family, uint32_t codepoint)
if (!fc->fallbacks || fc->fallbacks->nfont == 0)
return NULL;
+ if (codepoint == 0) {
+ char *family = NULL;
+ result = FcPatternGetString(fc->fallbacks->fonts[0], FC_FAMILY, 0,
+ (FcChar8 **)&family);
+ if (result == FcResultMatch) {
+ return strdup(family);
+ } else {
+ return NULL;
+ }
+ }
+
// fallback_chars is the union of all available charsets, so
// if we can't find the glyph in there, the system does not
// have any font to render this glyph.
@@ -194,8 +205,11 @@ static char *get_fallback(void *priv, const char *family, uint32_t codepoint)
char *family = NULL;
result = FcPatternGetString(pattern, FC_FAMILY, 0,
(FcChar8 **)&family);
- family = strdup(family);
- return family;
+ if (result == FcResultMatch) {
+ return strdup(family);
+ } else {
+ return NULL;
+ }
}
}