]> granicus.if.org Git - libass/commitdiff
Select the first charmap in the font, if FreeType did not autoselect any.
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 15 Feb 2007 22:03:09 +0000 (22:03 +0000)
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 15 Feb 2007 22:03:09 +0000 (22:03 +0000)
This happens, for example, with fonts only having an Apple Roman charmap.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22228 b3059339-0415-0410-9bf9-f77b7e298cf2

libass/ass_font.c

index 1ae136bc1efa21a0b90ffa38e671f96e5ab668a6..285ecde63a92212538cba304febbd829e758a6cc 100644 (file)
@@ -47,9 +47,19 @@ static void charmap_magic(FT_Face face)
                unsigned eid = cmap->encoding_id;
                if (pid == 3 /*microsoft*/ && (eid == 1 /*unicode bmp*/ || eid == 10 /*full unicode*/)) {
                        FT_Set_Charmap(face, cmap);
-                       break;
+                       return;
                }
        }
+
+       if (!face->charmap) {
+               if (face->num_charmaps == 0) {
+                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NoCharmaps);
+                       return;
+               }
+               mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NoCharmapAutodetected);
+               FT_Set_Charmap(face, face->charmaps[0]);
+               return;
+       }
 }
 
 /**