changeset 726:2cbe922e2f3c

Deal with unicode subs (-unicode -nounicode).
author atmosfear
date Tue, 08 May 2001 19:40:10 +0000
parents 3e5dbbc42864
children cc208ebcb9f6
files libvo/sub.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sub.c	Tue May 08 19:39:21 2001 +0000
+++ b/libvo/sub.c	Tue May 08 19:40:10 2001 +0000
@@ -89,6 +89,7 @@
 }
 
 subtitle* vo_sub=NULL;
+int sub_unicode=0;
 
 void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
     int i;
@@ -105,7 +106,7 @@
 
         for(j=0;j<len;j++){
           int c=text[j];
-          int w = vo_font->width[(c<0x80)?c:(c<<8)+text[++j]];
+          int w = vo_font->width[sub_unicode?((c<0x80)?c:(c<<8)+text[++j]):c];
           if(w>100) printf("gazvan: %d (%d=%c)\n",w,c,c);
           xsize+=w+vo_font->charspace;
         }
@@ -118,7 +119,7 @@
         for(j=0;j<len;j++){
           int c=text[j];
           int font;
-          if (c>=0x80) c=(c<<8)+text[++j];
+          if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
           font = vo_font->font[c];
           if(x>=0 && x+vo_font->width[c]<dxs)
           if(font>=0)