summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-12-17 00:55:25 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-12-17 00:55:25 +0000
commit628e1a170a72e4fd2cc22933dc48eaa49eaf055d (patch)
tree7e23718683712a039245240ce3aa0b62e2115f36 /src
parent5b98ada2817b71f1fbaa20a15d3b87fb6e8da2c5 (diff)
downloadxine-lib-628e1a170a72e4fd2cc22933dc48eaa49eaf055d.tar.gz
xine-lib-628e1a170a72e4fd2cc22933dc48eaa49eaf055d.tar.bz2
reduce font size to make it fit on screen
CVS patchset: 1265 CVS date: 2001/12/17 00:55:25
Diffstat (limited to 'src')
-rw-r--r--src/libsputext/xine_decoder.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c
index 62257ae72..26dadc827 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.9 2001/12/17 00:19:21 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.10 2001/12/17 00:55:25 miguelfreitas Exp $
*
* code based on mplayer module:
*
@@ -860,22 +860,35 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
if (subtitle) {
int line, y;
+ int font_size;
this->renderer->filled_rect (this->osd, 0, 0, this->width-1, this->line_height * SUB_MAX_TEXT - 1, 0);
y = (SUB_MAX_TEXT - subtitle->lines) * this->line_height;
-
+ font_size = this->font_size;
+
for (line=0; line<subtitle->lines; line++) {
- int w,h,x;
-
- this->renderer->get_text_size( this->osd, subtitle->text[line],
- &w, &h);
-
- x = (this->width - w) / 2;
-
- this->renderer->render_text (this->osd, x, y + line*this->line_height, subtitle->text[line]);
+ int w,h,x;
+
+ while(1) {
+ this->renderer->get_text_size( this->osd, subtitle->text[line],
+ &w, &h);
+ x = (this->width - w) / 2;
+
+ if( w > this->width && font_size > 16 ) {
+ font_size -= 4;
+ this->renderer->set_font (this->osd, this->font, font_size);
+ } else {
+ break;
+ }
+ }
+
+ this->renderer->render_text (this->osd, x, y + line*this->line_height, subtitle->text[line]);
}
-
+
+ if( font_size != this->font_size )
+ this->renderer->set_font (this->osd, this->font, this->font_size);
+
this->renderer->set_text_palette (this->osd, -1);
this->renderer->show (this->osd, pts );
this->renderer->hide (this->osd, pts_end);