diff options
author | Dongsu Park <dpark1978@gmail.com> | 2008-01-06 16:03:20 +0000 |
---|---|---|
committer | Dongsu Park <dpark1978@gmail.com> | 2008-01-06 16:03:20 +0000 |
commit | 45aa7ebe596abd3263c747c642a2416a7ebbbbba (patch) | |
tree | c5d990afb5b65c252b881d1a011f2933dc52fec3 | |
parent | ff632b94b6b25c35239ebb49a8e123d11f2fa8f4 (diff) | |
download | xine-lib-45aa7ebe596abd3263c747c642a2416a7ebbbbba.tar.gz xine-lib-45aa7ebe596abd3263c747c642a2416a7ebbbbba.tar.bz2 |
for resolving Korean subtitle bug
In draw_subtitle(), if the given encoding is one the CJK charset, colored
typefaces functionality is disabled and subtitles are printed with the
render_text() method. Otherwise subtitles are drawn by ogm_render_line()
function.
-rw-r--r-- | src/libsputext/xine_sputext_decoder.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index 1de1eb099..d45886300 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -506,11 +506,54 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text, (*sub_x), (*sub_y), (*max_width), (*alignment)); } +static int is_cjk_encoding(const char *enc) { + char **pstr; + + /* CJK charset strings defined in iconvdata/gconv-modules of glibc */ + static char *cjk_encoding_strings[] = { + "SJIS", + "CP932", + "EUC-KR", + "UHC", + "JOHAB", + "BIG5", + "BIG5HKSCS", + "EUC-JP-MS", + "EUC-JP", + "EUC-CN", + "GBBIG5", + "GBK", + "GBGBK", + "EUC-TW", + "ISO-2022-JP", + "ISO-2022-JP-2", + "ISO-2022-JP-3", + "ISO-2022-KR", + "ISO-2022-CN", + "ISO-2022-CN-EXT", + "GB18030", + "EUC-JISX0213", + "SHIFT_JISX0213", + NULL + }; + + /* return 1 if encoding string is one of the CJK(Chinese,Jananese,Korean) + * character set strings. */ + for (pstr = cjk_encoding_strings; *pstr; pstr++) { + if (strcasecmp(enc, *pstr) == 0) + return 1; + } + + return 0; +} + static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) { int line, y; int font_size; char *font; + char *encoding = (this->buf_encoding)?this->buf_encoding: + this->class->src_encoding; int sub_x, sub_y, max_width; int alignment; int rebuild_all; @@ -719,7 +762,12 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } } - ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + if( is_cjk_encoding(encoding) ) { + this->renderer->render_text (this->osd, x, y + line * this->line_height, + this->text[line], OSD_TEXT1); + } else { + ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + } } if( font_size != this->font_size ) |