From db093c7eb53682f80fe2675cb92f8dd28e94b760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Thu, 18 Sep 2003 18:17:12 +0000 Subject: Adjust size of subtitle font ONLY according to get_text_size(), which right handles multibyte strings. (current xine CVS adjusted size also before computing text size) Possibility to select the smallest font too. CVS patchset: 5403 CVS date: 2003/09/18 18:17:12 --- src/libsputext/xine_decoder.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index af53c0828..3e044b008 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.62 2003/09/18 18:14:50 valtri Exp $ + * $Id: xine_decoder.c,v 1.63 2003/09/18 18:17:12 valtri Exp $ * */ @@ -45,7 +45,8 @@ typedef enum { - SUBTITLE_SIZE_SMALL = 0, + SUBTITLE_SIZE_TINY = 0, + SUBTITLE_SIZE_SMALL, SUBTITLE_SIZE_NORMAL, SUBTITLE_SIZE_LARGE, @@ -100,23 +101,11 @@ typedef struct sputext_decoder_s { static void update_font_size (sputext_decoder_t *this) { - static int sizes[SUBTITLE_SIZE_NUM][4] = { - { 16, 16, 16, 20 }, /* SUBTITLE_SIZE_SMALL */ - { 16, 16, 20, 24 }, /* SUBTITLE_SIZE_NORMAL */ - { 16, 20, 24, 32 }, /* SUBTITLE_SIZE_LARGE */ - }; + static int sizes[SUBTITLE_SIZE_NUM] = { 16, 20, 24, 32 }; - int *vec = sizes[this->class->subtitle_size]; int y; - if( this->width >= 512 ) - this->font_size = vec[3]; - else if( this->width >= 384 ) - this->font_size = vec[2]; - else if( this->width >= 320 ) - this->font_size = vec[1]; - else - this->font_size = vec[0]; + this->font_size = sizes[this->class->subtitle_size]; this->line_height = this->font_size + 10; @@ -452,7 +441,9 @@ static void update_src_encoding(void *class_gen, xine_cfg_entry_t *entry) static void *init_spu_decoder_plugin (xine_t *xine, void *data) { - static char *subtitle_size_strings[] = { "small", "normal", "large", NULL }; + static char *subtitle_size_strings[] = { + "tiny", "small", "normal", "large", NULL + }; sputext_class_t *this ; #ifdef LOG -- cgit v1.2.3