summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2010-08-01 23:52:30 +0200
committerGrigori Goronzy <greg@blackbox>2010-08-01 23:58:19 +0200
commit96057dc0ba9b28c4ab168695f2500135e3337ca7 (patch)
treecdef219786a7fa6f97c213e930db6421b1e2b4d3
parentc465efc585692d4b7764ae88d897ede18c28d25b (diff)
downloadlibass-96057dc0ba9b28c4ab168695f2500135e3337ca7.tar.bz2
libass-96057dc0ba9b28c4ab168695f2500135e3337ca7.tar.xz
Fall back to first charmap as last resort
If we're already after the font reselection stage and a glyph cannot be found in a font, try again with the first charmap as a last resort. This is needed for old "symbol" fonts, for example.
-rw-r--r--libass/ass_font.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index ad2863c..6a1faab 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -446,6 +446,14 @@ FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
if (face_idx >= 0) {
face = font->faces[face_idx];
index = FT_Get_Char_Index(face, ch);
+ if (index == 0 && face->num_charmaps > 0) {
+ ass_msg(font->library, MSGL_WARN,
+ "Glyph 0x%X not found, falling back to first charmap", ch);
+ FT_CharMap cur = face->charmap;
+ FT_Set_Charmap(face, face->charmaps[0]);
+ index = FT_Get_Char_Index(face, ch);
+ FT_Set_Charmap(face, cur);
+ }
if (index == 0) {
ass_msg(font->library, MSGL_ERR,
"Glyph 0x%X not found in font for (%s, %d, %d)",