diff options
author | wm4 <wm4@nowhere> | 2013-06-17 23:52:49 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-22 19:07:58 +0200 |
commit | 28908369203be43c32bd1ac499fa3dc825b78c96 (patch) | |
tree | 743653a512eb9bd8b1c6ea40faff29b296d01312 | |
parent | e864a3b7a9cc657239fa7e5c0079d5ed1432a553 (diff) | |
download | libass-28908369203be43c32bd1ac499fa3dc825b78c96.tar.bz2 libass-28908369203be43c32bd1ac499fa3dc825b78c96.tar.xz |
Improve font mismatch message
Example for an old message:
[ass] fontconfig: Selected font is not the requested one: 'DejaVu Sans' != 'Wingdings'
it was hard to tell which was the selected and the requested font.
Also, it's not really clear what's the problem at all. Why would it
select a different font? Obviously, the issue is that it can't find
the font in the first place.
Now it prints:
[ass] fontconfig: cannot find glyph U+006C in font 'Wingdings', falling back to 'DejaVu Sans'
Or if the code parameter for select_font() is 0:
[ass] fontconfig: cannot find font 'Wingdings', falling back to 'DejaVu Sans'
I'm not sure if this message is really accurate in all cases. It's
possible that there are more reasons for failure. But all things
considered, this should be easier to understand.
-rw-r--r-- | libass/ass_fontconfig.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index d3dddea..b8ad9ec 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -257,11 +257,18 @@ static char *select_font(ASS_Library *library, FCInstance *priv, if (!treat_family_as_pattern && !(r_family && strcasecmp((const char *) r_family, family) == 0) && - !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0)) - ass_msg(library, MSGL_WARN, - "fontconfig: Selected font is not the requested one: " - "'%s' != '%s'", - (const char *) (r_fullname ? r_fullname : r_family), family); + !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0)) { + char *fallback = (char *) (r_fullname ? r_fullname : r_family); + if (code) { + ass_msg(library, MSGL_WARN, + "fontconfig: cannot find glyph U+%04X in font '%s', falling back to '%s'", + (unsigned int)code, family, fallback); + } else { + ass_msg(library, MSGL_WARN, + "fontconfig: cannot find font '%s', falling back to '%s'", + family, fallback); + } + } result = FcPatternGetString(rpat, FC_STYLE, 0, &r_style); if (result != FcResultMatch) |