Commit ab9b56ca authored by Grigori Goronzy's avatar Grigori Goronzy Committed by Jean-Baptiste Kempf

libass: match font attachments based on extension

Sometimes fonts are muxed with the wrong MIME type, but we should
still be able to use them. Especially OpenType font collections are
affected by this. Match attachments by extensions .ttf, .otf and .ttc
in addition to MIME type to fix these issues.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3e6913a3
......@@ -187,7 +187,21 @@ static int Create( vlc_object_t *p_this )
{
input_attachment_t *p_attach = pp_attachments[k];
bool found = false;
/* Check mimetype*/
if( !strcasecmp( p_attach->psz_mime, "application/x-truetype-font" ) )
found = true;
/* Then extension */
else if( !found && strlen( p_attach->psz_name ) > 4 )
{
char *ext = p_attach->psz_name + strlen( p_attach->psz_name ) - 4;
if( !strcasecmp( ext, ".ttf" ) || !strcasecmp( ext, ".otf" ) || !strcasecmp( ext, ".ttc" ) )
found = true;
}
if( found )
{
msg_Dbg( p_dec, "adding embedded font %s", p_attach->psz_name );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment