summaryrefslogtreecommitdiffstats
path: root/libass/ass_cache.c
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-03 23:11:00 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-03 23:11:00 +0000
commiteed98361befc05a44bae35f68a6348e49b9ecabc (patch)
tree8a8ad3d9cb48e57df5946d6a51ea34b47ac143a2 /libass/ass_cache.c
parent8fccf229c3f4f7b41b63ff9b5b5e950a1ed61235 (diff)
downloadlibass-eed98361befc05a44bae35f68a6348e49b9ecabc.tar.bz2
libass-eed98361befc05a44bae35f68a6348e49b9ecabc.tar.xz
Prefer microsoft-specific charmaps to all other.
There are some fonts with both 'Unicode' and 'Microsoft/Unicode' charmaps, and the second always seems to be the right choice. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20653 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass/ass_cache.c')
-rw-r--r--libass/ass_cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libass/ass_cache.c b/libass/ass_cache.c
index a2f5bf2..7ed4d7e 100644
--- a/libass/ass_cache.c
+++ b/libass/ass_cache.c
@@ -57,6 +57,24 @@ static int font_compare(face_desc_t* a, face_desc_t* b) {
}
/**
+ * Select Microfost Unicode CharMap, if the font has one.
+ * Otherwise, let FreeType decide.
+ */
+static void charmap_magic(FT_Face face)
+{
+ int i;
+ for (i = 0; i < face->num_charmaps; ++i) {
+ FT_CharMap cmap = face->charmaps[i];
+ unsigned pid = cmap->platform_id;
+ unsigned eid = cmap->encoding_id;
+ if (pid == 3 /*microsoft*/ && (eid == 1 /*unicode bmp*/ || eid == 10 /*full unicode*/)) {
+ FT_Set_Charmap(face, cmap);
+ break;
+ }
+ }
+}
+
+/**
* \brief Get a face object, either from cache or created through FreeType+FontConfig.
* \param library FreeType library object
* \param fontconfig_priv fontconfig private data
@@ -91,6 +109,8 @@ int ass_new_face(FT_Library library, void* fontconfig_priv, face_desc_t* desc, /
no_more_font_messages = 1;
return 1;
}
+
+ charmap_magic(*face);
item = face_cache + face_cache_size;
item->path = strdup(path);