aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-15 22:03:09 +0000
committerGravatar eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-15 22:03:09 +0000
commit1400b0f4367e01aad5228f3213063a541955f061 (patch)
tree35b2ea36afc09b0717280bcf8078478ca1c6d24e
parent520db0d850aabb8beca14603ee46b067871831a6 (diff)
Select the first charmap in the font, if FreeType did not autoselect any.
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
-rw-r--r--help/help_mp-en.h2
-rw-r--r--libass/ass_font.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index dd585c0ee6..116537d33f 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -2049,3 +2049,5 @@ static char help_text[]=
#define MSGTR_LIBASS_GlyphNotFoundReselectingFont "[ass] Glyph 0x%X not found, reselecting font for (%s, %d, %d)\n"
#define MSGTR_LIBASS_GlyphNotFound "[ass] Glyph 0x%X not found in font for (%s, %d, %d)\n"
#define MSGTR_LIBASS_ErrorOpeningMemoryFont "[ass] Error opening memory font: %s\n"
+#define MSGTR_LIBASS_NoCharmaps "[ass] font face with no charmaps\n"
+#define MSGTR_LIBASS_NoCharmapAutodetected "[ass] no charmap autodetected, trying the first one\n"
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 1ae136bc1e..285ecde63a 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -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;
+ }
}
/**