# HG changeset patch # User ben # Date 1179674276 0 # Node ID 10a7279b8e568b81901e4d6862b32d670140ecdf # Parent 5cec8dd2fe24e5895000fbe5a247a294f796dd77 get rid of -menu-utf8 and -menu-unicode once for all, patch by Guillaume Lecerf diff -r 5cec8dd2fe24 -r 10a7279b8e56 cfg-mplayer.h --- a/cfg-mplayer.h Sun May 20 12:20:03 2007 +0000 +++ b/cfg-mplayer.h Sun May 20 15:17:56 2007 +0000 @@ -71,8 +71,6 @@ #ifdef HAVE_MENU extern int menu_startup; extern int menu_keepdir; -extern int menu_utf8; -extern int menu_unicode; #ifdef USE_FRIBIDI extern char *menu_fribidi_charset; extern int menu_flip_hebrew; @@ -300,8 +298,6 @@ {"menu-cfg", &menu_cfg, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, {"menu-startup", &menu_startup, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, {"menu-keepdir", &menu_keepdir, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, - {"menu-utf8", &menu_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"menu-unicode", &menu_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL}, #ifdef USE_FRIBIDI {"menu-fribidi-charset", &menu_fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"menu-flip-hebrew", &menu_flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL}, diff -r 5cec8dd2fe24 -r 10a7279b8e56 libmenu/menu.c --- a/libmenu/menu.c Sun May 20 12:20:03 2007 +0000 +++ b/libmenu/menu.c Sun May 20 15:17:56 2007 +0000 @@ -297,27 +297,10 @@ return h; } -int menu_utf8 = 0; -int menu_unicode = 0; - -static int get_next_char(char **txt) -{ - int c; - c = (unsigned char)*(*txt)++; - if (c >= 0x80) { - if (menu_utf8) - c = utf8_get_char((const char**)txt); - else if (menu_unicode) - c = (c<<8) + (unsigned char)*(*txt)++; - } - if (!c) c++; // avoid UCS 0 - return c; -} - static void render_txt(char *txt) { while (*txt) { - int c = get_next_char(&txt); + int c = utf8_get_char(&txt); render_one_glyph(vo_font, c); } } @@ -345,11 +328,7 @@ if (char_set_num == -1) { fribidi_set_mirroring (1); fribidi_set_reorder_nsm (0); - if (menu_utf8 == 0) { - char_set_num = fribidi_parse_charset(menu_fribidi_charset ? menu_fribidi_charset : "ISO8859-8"); - } else { - char_set_num = fribidi_parse_charset("UTF-8"); - } + char_set_num = fribidi_parse_charset("UTF-8"); buffer_size = FFMAX(1024,len+1); logical = malloc(buffer_size); visual = malloc(buffer_size); @@ -388,7 +367,7 @@ render_txt(txt); while (*txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); if ((font=vo_font->font[c])>=0 && (x + vo_font->width[c] <= mpi->w) && (y + vo_font->pic_a[font]->h <= mpi->h)) draw_alpha(vo_font->width[c], vo_font->pic_a[font]->h, vo_font->pic_b[font]->bmp+vo_font->start[c], @@ -481,7 +460,7 @@ // Jump some the beginnig text if needed while(sy < ymin && *txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); if(c == '\n' || (warp && ll + vo_font->width[c] > w)) { ll = 0; sy += vo_font->height + vspace; @@ -555,7 +534,7 @@ } while(sx < xmax && txt != line_end) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); font = vo_font->font[c]; if(font >= 0) { int cs = (vo_font->pic_a[font]->h - vo_font->height) / 2; @@ -583,7 +562,7 @@ int l = 0; render_txt(txt); while (*txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); l += vo_font->width[c]+vo_font->charspace; } return l - vo_font->charspace; @@ -595,7 +574,7 @@ render_txt(txt); while (*txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); if(c == '\n' || (warp && i + vo_font->width[c] >= max_width)) { if(*txt) l++; @@ -615,7 +594,7 @@ int l = 1, i = 0; render_txt(txt); while (*txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); if(c == '\n' || i + vo_font->width[c] > max_width) { l++; i = 0; @@ -630,7 +609,7 @@ int i = 0; render_txt(txt); while (*txt) { - int c=get_next_char(&txt); + int c=utf8_get_char(&txt); if(c == '\n') { txt++; break;