X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Flibass.c;h=aa38f1b2f609072b6d003b46b7b4fd694dfebbd2;hb=b945cfa8e76f8835340b2ae49bc81e39fa8bf4f7;hp=3ad95127dcb56bb42c9c412aed8d6ba8530272ee;hpb=728866a80a3d4620fa470a9fe21f983d527d0a5c;p=vlc diff --git a/modules/codec/libass.c b/modules/codec/libass.c index 3ad95127dc..aa38f1b2f6 100644 --- a/modules/codec/libass.c +++ b/modules/codec/libass.c @@ -1,24 +1,24 @@ /***************************************************************************** * SSA/ASS subtitle decoder using libass. ***************************************************************************** - * Copyright (C) 2008-2009 the VideoLAN team + * Copyright (C) 2008-2009 VLC authors and VideoLAN * $Id$ * * Authors: Laurent Aimar * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -42,7 +42,7 @@ #include -#if defined(WIN32) +#if defined(_WIN32) # include #endif @@ -167,7 +167,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 ); @@ -196,21 +210,24 @@ static int Create( vlc_object_t *p_this ) ass_set_font_scale( p_renderer, 1.0 ); ass_set_line_spacing( p_renderer, 0.0 ); +#if defined( __ANDROID__ ) + const char *psz_font = "/system/fonts/DroidSans-Bold.ttf"; + const char *psz_family = "Droid Sans Bold"; +#else const char *psz_font = NULL; /* We don't ship a default font with VLC */ const char *psz_family = "Arial"; /* Use Arial if we can't find anything more suitable */ +#endif #ifdef HAVE_FONTCONFIG -#if defined(WIN32) +#if defined(_WIN32) dialog_progress_bar_t *p_dialog = dialog_ProgressCreate( p_dec, _("Building font cache"), _( "Please wait while your font cache is rebuilt.\n" "This should take less than a minute." ), NULL ); - if( p_dialog ) - dialog_ProgressSet( p_dialog, NULL, 0.2 ); #endif ass_set_fonts( p_renderer, psz_font, psz_family, true, NULL, 1 ); // setup default font/family -#ifdef WIN32 +#ifdef _WIN32 if( p_dialog ) { dialog_ProgressSet( p_dialog, NULL, 1.0 );