summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantišek Dvořák <valtri@users.sourceforge.net>2003-09-18 18:14:50 +0000
committerFrantišek Dvořák <valtri@users.sourceforge.net>2003-09-18 18:14:50 +0000
commit43ed8e88c49089b9bc6cabbba528fc9b7eb6cf5e (patch)
treee6a3402ce996d4313c0cbd8d8fe80d3dec059a8c
parent02c325dc9e6584c71fb67449aeb505373141724a (diff)
downloadxine-lib-43ed8e88c49089b9bc6cabbba528fc9b7eb6cf5e.tar.gz
xine-lib-43ed8e88c49089b9bc6cabbba528fc9b7eb6cf5e.tar.bz2
Generating codepages with more than 256 characters (max. 16-bit).
Right computing text size of multibyte texts in OSD. Different alias character for missing character in the conversion and in the font: #, _ CVS patchset: 5402 CVS date: 2003/09/18 18:14:50
-rw-r--r--misc/xine-fontconv.c10
-rw-r--r--src/input/input_dvb.c4
-rw-r--r--src/libspucc/cc_decoder.c8
-rw-r--r--src/libsputext/xine_decoder.c9
-rw-r--r--src/libsputext/xine_decoder_ogm.c10
-rw-r--r--src/xine-engine/osd.c300
-rw-r--r--src/xine-engine/osd.h22
-rw-r--r--src/xine-engine/xine_interface.c5
8 files changed, 234 insertions, 134 deletions
diff --git a/misc/xine-fontconv.c b/misc/xine-fontconv.c
index 46d7626a5..7a92417db 100644
--- a/misc/xine-fontconv.c
+++ b/misc/xine-fontconv.c
@@ -165,7 +165,7 @@ void list_free(item_t *list) {
uint16_t generate_unicodes_list(item_t **list, char **pages, int number) {
int page;
uint16_t codes_count = 0; /* unicode counter */
- unsigned char z; /* index in codepage */
+ int32_t z; /* index in the codepage */
iconv_t cd; /* iconv conversion descriptor */
*list = NULL;
@@ -180,17 +180,17 @@ uint16_t generate_unicodes_list(item_t **list, char **pages, int number) {
printf("Used encoding \"%s\"\n", pages[page]);
/* add new unicodes into list */
- for (z = 32; z < 0xff; z++) {
+ for (z = 32; z < 0xFFFF; z++) {
uint16_t unicode;
char *inbuf = (char *)&z;
char *outbuf = (char *)&unicode;
- size_t inbytesleft = 1;
+ size_t inbytesleft = z <= 0xFF ? 1 : 2;
size_t outbytesleft = 2;
size_t count;
/* get unicode value from index 'z' in this codepage 'pages[i]' */
count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
- if (count == (size_t)-1) {
+ if (count == (size_t)-1 || inbytesleft != 0) {
/* unused index 'z' in this codepage */
continue;
}
@@ -510,7 +510,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness,
printf("\n");
list_free(error_unicodes);
}
- printf ("generated %s (%d)\n", filename, font.num_fontchars);
+ printf ("generated %s (%d characters)\n", filename, font.num_fontchars);
}
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 7abd8e334..88c76daac 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -376,7 +376,6 @@ static void osd_show_channel (dvb_input_plugin_t *this) {
if ( (channel >= 0) && (channel < this->num_channels) )
this->stream->osd_renderer->render_text (this->osd, 10, 10+i*35,
this->channels[channel].name,
- "iso-8859-1",
OSD_TEXT3);
channel ++;
}
@@ -461,7 +460,6 @@ static void do_record (dvb_input_plugin_t *this) {
this->stream->osd_renderer->filled_rect (this->rec_osd, 0, 0, 300, 40, 0);
this->stream->osd_renderer->render_text (this->rec_osd, 10, 10, filename,
- "iso-8859-1",
OSD_TEXT3);
this->stream->osd_renderer->show (this->rec_osd, 0);
@@ -935,6 +933,7 @@ static int dvb_plugin_open (input_plugin_t *this_gen) {
410, 410);
this->stream->osd_renderer->set_position (this->osd, 20, 20);
this->stream->osd_renderer->set_font (this->osd, "cetus", 32);
+ this->stream->osd_renderer->set_encoding(this->osd, NULL);
this->stream->osd_renderer->set_text_palette (this->osd,
TEXTPALETTE_WHITE_NONE_TRANSLUCID,
OSD_TEXT3);
@@ -947,6 +946,7 @@ static int dvb_plugin_open (input_plugin_t *this_gen) {
301, 41);
this->stream->osd_renderer->set_position (this->rec_osd, 10, 10);
this->stream->osd_renderer->set_font (this->rec_osd, "cetus", 16);
+ this->stream->osd_renderer->set_encoding(this->rec_osd, NULL);
this->stream->osd_renderer->set_text_palette (this->rec_osd,
TEXTPALETTE_WHITE_NONE_TRANSLUCID,
OSD_TEXT3);
diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c
index 5c47b4a53..24b8e1674 100644
--- a/src/libspucc/cc_decoder.c
+++ b/src/libspucc/cc_decoder.c
@@ -20,7 +20,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: cc_decoder.c,v 1.21 2003/05/06 14:02:26 tchamp Exp $
+ * $Id: cc_decoder.c,v 1.22 2003/09/18 18:14:50 valtri Exp $
*
* stuff needed to provide closed captioning decoding and display
*
@@ -353,8 +353,6 @@ struct cc_decoder_s {
/* active OSD renderer */
osd_renderer_t *renderer;
- /* caption display object */
- osd_object_t *cap_display;
/* true when caption currently is displayed */
int displayed;
@@ -378,6 +376,7 @@ static void get_font_metrics(osd_renderer_t *renderer,
*maxh = 0;
renderer->set_font(testc, (char *) fontname, font_size);
+ renderer->set_encoding(testc, NULL);
for (c = 32; c < 256; c++) {
int tw, th;
char buf[2];
@@ -652,7 +651,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum)
/* text is already mapped from EIA-608 into iso-8859-1 */
osd_renderer->render_text(renderer->cap_display,
x + cumulative_seg_width[seg], y, buf,
- "iso-8859-1", textcol);
+ textcol);
}
pos = ccrow_find_next_text_part(this, endpos);
@@ -921,6 +920,7 @@ static void cc_renderer_adjust_osd_object(cc_renderer_t *this)
this->height);
this->osd_renderer->set_palette(this->cap_display, this->cc_palette,
this->cc_trans);
+ this->osd_renderer->set_encoding(this->cap_display, NULL);
}
diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c
index 4f3c02cc4..af53c0828 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.61 2003/07/12 17:04:36 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.62 2003/09/18 18:14:50 valtri Exp $
*
*/
@@ -161,7 +161,9 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
y = (SUB_MAX_TEXT - this->lines) * this->line_height;
font_size = this->font_size;
-
+
+ this->renderer->set_encoding(this->osd, this->class->src_encoding);
+
for (line=0; line<this->lines; line++) {
int w,h,x;
@@ -179,8 +181,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
}
this->renderer->render_text (this->osd, x, y + line*this->line_height,
- this->text[line], this->class->src_encoding,
- OSD_TEXT1);
+ this->text[line], OSD_TEXT1);
}
if( font_size != this->font_size )
diff --git a/src/libsputext/xine_decoder_ogm.c b/src/libsputext/xine_decoder_ogm.c
index 3a05ee092..59b062cc9 100644
--- a/src/libsputext/xine_decoder_ogm.c
+++ b/src/libsputext/xine_decoder_ogm.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_ogm.c,v 1.4 2003/08/29 11:44:53 andruil Exp $
+ * $Id: xine_decoder_ogm.c,v 1.5 2003/09/18 18:14:50 valtri Exp $
*
*/
@@ -167,7 +167,7 @@ static int get_width(spuogm_decoder_t *this, char* text) {
}
default:
letter[0]=text[i];
- this->renderer->get_text_size( this->osd, letter, &w, &dummy);
+ this->renderer->get_text_size(this->osd, letter, &w, &dummy);
width=width+w;
i++;
}
@@ -212,9 +212,8 @@ static void render_line(spuogm_decoder_t *this, int x, int y, char* text) {
}
default:
letter[0]=text[i];
- this->renderer->render_text( this->osd, x, y, letter,
- this->class->src_encoding,OSD_TEXT1);
- this->renderer->get_text_size( this->osd, letter, &w, &dummy);
+ this->renderer->render_text(this->osd, x, y, letter, OSD_TEXT1);
+ this->renderer->get_text_size(this->osd, letter, &w, &dummy);
x=x+w;
i++;
}
@@ -230,6 +229,7 @@ static void draw_subtitle(spuogm_decoder_t *this, int64_t sub_start, int64_t sub
y = (SUB_MAX_TEXT - this->lines) * this->line_height;
font_size = this->font_size;
+ this->renderer->set_encoding(this->osd, this->class->src_encoding);
for (line=0; line<this->lines; line++) {
int w,x;
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 98f1732e0..2df12d51f 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -60,8 +60,15 @@
#define BINARY_SEARCH 1
-/* unicode value of alias character (it used if conversion fails) */
-#define ALIAS_CHARACTER ' '
+/* unicode value of alias character,
+ * used if conversion fails
+ */
+#define ALIAS_CHARACTER_CONV '#'
+
+/* unicode value of alias character,
+ * used if character isn't in the font
+ */
+#define ALIAS_CHARACTER_FONT '_'
#ifdef MAX
#undef MAX
@@ -131,7 +138,12 @@ static osd_object_t *osd_new_object (osd_renderer_t *this, int width, int height
memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0]));
osd->handle = -1;
-
+
+#ifndef _MSC_VER
+ osd->cd = (iconv_t)-1;
+ osd->encoding = NULL;
+#endif
+
pthread_mutex_unlock (&this->osd_mutex);
#ifdef LOG_DEBUG
@@ -711,36 +723,141 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
}
-#ifdef BINARY_SEARCH
/*
- * search the character in the sorted array
+ * search the character in the sorted array,
+ *
+ * returns ALIAS_CHARACTER_FONT if character 'code' isn't found,
+ * returns 'n' on error
*/
-static int binsearch(osd_fontchar_t *array, size_t n, uint16_t code) {
+static int osd_search(osd_fontchar_t *array, size_t n, uint16_t code) {
+#ifdef BINARY_SEARCH
size_t i, left, right;
if (!n) return 0;
left = 0;
right = n - 1;
- while (right > left) {
+ while (left < right) {
i = (left + right) >> 1;
if (code <= array[i].code) right = i;
else left = i + 1;
}
- return array[right].code == code ? right : n;
+ if (array[right].code == code)
+ return right;
+ else
+ return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n;
+#else
+ size_t i;
+
+ for( i = 0; i < n; i++ ) {
+ if( font->fontchar[i].code == unicode )
+ break;
+ }
+
+ if (i < n)
+ return i;
+ else
+ return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n;
+#endif
+}
+
+
+#ifndef _MSC_VER
+/*
+ * get next unicode value
+ */
+static uint16_t osd_iconv_getunicode(iconv_t *cd, const char *encoding, char **inbuf, size_t *inbytesleft) {
+ uint16_t unicode;
+ char *outbuf = (char*)&unicode;
+ size_t outbytesleft = 2;
+ size_t count;
+
+ if (cd != (iconv_t)-1) {
+ /* get unicode value from iconv */
+ count = iconv(cd, inbuf, inbytesleft, &outbuf, &outbytesleft);
+ if (count == (size_t)-1 && errno != E2BIG) {
+ /* unknown character or character wider than 16 bits, try skip one byte */
+ printf(_("osd: unknown sequence starting with byte 0x%02X"
+ " in encoding \"%s\", skipping\n"), (*inbuf)[0] & 0xFF, encoding);
+ if (*inbytesleft) {
+ (*inbytesleft)--;
+ (*inbuf)++;
+ }
+ return ALIAS_CHARACTER_CONV;
+ }
+ } else {
+ /* direct mapping without iconv */
+ unicode = (*inbuf)[0];
+ (*inbuf)++;
+ (*inbytesleft)--;
+ }
+
+ return unicode;
+}
+#endif
+
+
+/*
+ * free iconv encoding
+ */
+static void osd_free_encoding(osd_object_t *osd) {
+#ifndef _MSC_VER
+ if (osd->cd != (iconv_t)-1) {
+ iconv_close(osd->cd);
+ osd->cd = (iconv_t)-1;
+ }
+ if (osd->encoding) {
+ free(osd->encoding);
+ osd->encoding = NULL;
+ }
+#endif
}
+
+
+/*
+ * set encoding of text
+ *
+ * NULL ... no conversion (iso-8859-1)
+ * "" ... locale encoding
+ */
+static int osd_set_encoding (osd_object_t *osd, const char *encoding) {
+#ifndef _MSC_VER
+ osd_free_encoding(osd);
+
+ if (!encoding) return 1;
+ if (!encoding[0]) {
+#ifdef HAVE_LANGINFO_CODESET
+ if ((encoding = nl_langinfo(CODESET)) == NULL) {
+ printf(_("osd: can't find out current locale character set\n"));
+ return 0;
+ }
+#else
+ return 0;
#endif
+ }
+
+ /* prepare conversion to UCS-2 */
+ if ((osd->cd = iconv_open("UCS-2", encoding)) == (iconv_t)-1) {
+ printf(_("osd: unsupported conversion %s -> UCS-2, "
+ "no conversion performed\n"), encoding);
+ return 0;
+ }
+
+ osd->encoding = strdup(encoding);
+ return 1;
+#else
+ return encoding == NULL;
+#endif /* _MSC_VER */
+}
/*
- * render text on x,y position
+ * render text in current encoding on x,y position
* no \n yet
- * if encoding == NULL current locale encoding is used
*/
static int osd_render_text (osd_object_t *osd, int x1, int y1,
- const char *text, const char *encoding,
- int color_base) {
+ const char *text, int color_base) {
osd_renderer_t *this = osd->renderer;
osd_font_t *font;
@@ -750,10 +867,6 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
uint16_t unicode;
size_t inbytesleft;
-#ifndef _MSC_VER
- iconv_t cd;
-#endif /* _MSC_VER */
-
#ifdef LOG_DEBUG
printf("osd_render_text %p (%d,%d) \"%s\"\n", osd, x1, y1, text);
#endif
@@ -786,53 +899,16 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
inbuf = text;
inbytesleft = strlen(text);
-
- if (!encoding) {
-#ifdef HAVE_LANGINFO_CODESET
- if ((encoding = nl_langinfo(CODESET)) == NULL) {
- printf(_("osd: can't find out current locale character set\n"));
- encoding = "iso-8859-1";
- }
-#else
- encoding = "iso-8859-1";
-#endif
- }
-
-#ifndef _MSC_VER
- /* prepare conversion to UCS-2 */
- if ((cd = iconv_open("UCS-2", encoding)) == (iconv_t)-1) {
- printf(_("osd: unsupported conversion %s -> UCS-2, "
- "no conversion performed\n"), encoding);
- }
-#endif /* _MSC_VER */
while( inbytesleft ) {
- char *outbuf = (char*)&unicode;
- size_t outbytesleft = 2;
- size_t count;
-
#ifndef _MSC_VER
- if (cd == (iconv_t)-1) {
- /* direct mapping without iconv */
- unicode = inbuf[0];
- inbuf++;
- inbytesleft--;
- } else {
- /* get unicode value from iconv */
- /* FIXME: we cast away the const from inbuf; Why is iconv() not const here,
- * does it change inbuf? */
- count = iconv(cd, (char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
- if (count == (size_t)-1 && errno != E2BIG) {
- /* unknown character or character wider than 16 bits, try skip one byte */
- printf(_("osd: unknown sequence starting with byte 0x%02X"
- " in encoding \"%s\", skipping\n"), inbuf[0] & 0xFF, encoding);
- if (!inbytesleft) break;
- inbytesleft--;
- inbuf++;
- unicode = ALIAS_CHARACTER;
- }
- }
-#endif /* _MSC_VER */
+ unicode = osd_iconv_getunicode(osd->cd, osd->encoding,
+ (char **)&inbuf, &inbytesleft);
+#else
+ unicode = inbuf[0];
+ inbuf++;
+ inbytesleft--;
+#endif
#ifdef HAVE_FT2
if (osd->ft2 && osd->ft2->useme) {
@@ -840,14 +916,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
} else {
#endif
-#ifdef BINARY_SEARCH
- i = binsearch(font->fontchar, font->num_fontchars, unicode);
-#else
- for( i = 0; i < font->num_fontchars; i++ ) {
- if( font->fontchar[i].code == unicode )
- break;
- }
-#endif
+ i = osd_search(font->fontchar, font->num_fontchars, unicode);
#ifdef LOG_DEBUG
printf("font %s [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i,
@@ -933,12 +1002,6 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
}
-#ifndef _MSC_VER
- if (cd != (iconv_t)-1) {
- iconv_close(cd);
- }
-#endif /* _MSC_VER */
-
pthread_mutex_unlock (&this->osd_mutex);
return 1;
@@ -951,7 +1014,10 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
osd_renderer_t *this = osd->renderer;
osd_font_t *font;
- int i, c;
+ int i;
+ const char *inbuf;
+ uint16_t unicode;
+ size_t inbytesleft;
#ifdef LOG_DEBUG
printf("osd_get_text_size %p \"%s\"\n", osd, text);
@@ -959,28 +1025,52 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
pthread_mutex_lock (&this->osd_mutex);
- font = osd->font;
-
+ {
+ int proceed = 0;
+
+ if ((font = osd->font)) proceed = 1;
+#ifdef HAVE_FT2
+ if (osd->ft2 && osd->ft2->useme) proceed = 1;
+#endif
+
+ if (proceed == 0) {
+ printf(_("osd: font isn't defined\n"));
+ pthread_mutex_unlock(&this->osd_mutex);
+ return 0;
+ }
+ }
+
*width = 0;
*height = 0;
+ inbuf = text;
+ inbytesleft = strlen(text);
+
+ while( inbytesleft ) {
+#ifndef _MSC_VER
+ unicode = osd_iconv_getunicode(osd->cd, osd->encoding,
+ (char **)&inbuf, &inbytesleft);
+#else
+ unicode = inbuf[0];
+ inbuf++;
+ inbytesleft--;
+#endif
+
#ifdef HAVE_FT2
- if (osd->ft2 && osd->ft2->useme) {
- int first = 1;
- FT_GlyphSlot slot = osd->ft2->face->glyph;
-
- while (*text) {
-
- i = FT_Get_Char_Index( osd->ft2->face, *text);
-
+ if (osd->ft2 && osd->ft2->useme) {
+ int first = 1;
+ FT_GlyphSlot slot = osd->ft2->face->glyph;
+
+ i = FT_Get_Char_Index( osd->ft2->face, unicode);
+
if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_DEFAULT)) {
- printf("osd: error loading glyph %i\n", i);
- text++;
- continue;
+ printf("osd: error loading glyph %i\n", i);
+ text++;
+ continue;
}
if (slot->format != ft_glyph_format_bitmap) {
- if (FT_Render_Glyph(osd->ft2->face->glyph, ft_render_mode_normal))
+ if (FT_Render_Glyph(osd->ft2->face->glyph, ft_render_mode_normal))
printf("osd: error in rendering\n");
}
if (first) *width += slot->bitmap_left;
@@ -989,29 +1079,19 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
/* font height from baseline to top */
*height = MAX(*height, slot->bitmap_top);
text++;
- }
- } else {
+ } else {
#endif
-
- while( font && *text ) {
- c = *text & 0xff;
-
- for( i = 0; i < font->num_fontchars; i++ ) {
- if( font->fontchar[i].code == c )
- break;
- }
-
- if ( i != font->num_fontchars ) {
- if( font->fontchar[i].height > *height )
- *height = font->fontchar[i].height;
- *width += font->fontchar[i].width;
- }
- text++;
- }
+ i = osd_search(font->fontchar, font->num_fontchars, unicode);
+ if ( i != font->num_fontchars ) {
+ if( font->fontchar[i].height > *height )
+ *height = font->fontchar[i].height;
+ *width += font->fontchar[i].width;
+ }
#ifdef HAVE_FT2
- } /* !(osd->ft2 && osd->ft2->useme) */
+ } /* !(osd->ft2 && osd->ft2->useme) */
#endif
+ }
pthread_mutex_unlock (&this->osd_mutex);
@@ -1090,13 +1170,14 @@ static void osd_free_object (osd_object_t *osd_to_close) {
while( osd ) {
if ( osd == osd_to_close ) {
free( osd->area );
+ if( osd->ft2 ) free( osd->ft2 );
+ osd_free_encoding(osd);
if( last )
last->next = osd->next;
else
this->osds = osd->next;
- if( osd->ft2 ) free( osd->ft2 );
free( osd );
break;
}
@@ -1214,6 +1295,7 @@ osd_renderer_t *osd_renderer_init( video_overlay_manager_t *video_overlay, confi
this->point = osd_point;
this->line = osd_line;
this->filled_rect = osd_filled_rect;
+ this->set_encoding = osd_set_encoding;
this->render_text = osd_render_text;
this->get_text_size = osd_get_text_size;
this->close = osd_renderer_close;
diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h
index c1652341e..b38522891 100644
--- a/src/xine-engine/osd.h
+++ b/src/xine-engine/osd.h
@@ -18,12 +18,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* OSD stuff (text and graphic primitives)
- * $Id: osd.h,v 1.17 2003/08/15 14:35:09 mroi Exp $
+ * $Id: osd.h,v 1.18 2003/09/18 18:14:51 valtri Exp $
*/
#ifndef HAVE_OSD_H
#define HAVE_OSD_H
+#ifndef _MSC_VER
+# include <iconv.h>
+#endif /* _MSC_VER */
+
#ifdef XINE_COMPILE
# include "video_overlay.h"
# ifdef __OSD_C__
@@ -54,6 +58,11 @@ struct osd_object_s {
uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */
int32_t handle;
+
+#ifndef _MSC_VER
+ iconv_t cd; /* iconv handle of encoding */
+ char *encoding; /* name of encoding */
+#endif
osd_font_t *font;
osd_ft2context_t *ft2;
@@ -147,9 +156,16 @@ struct osd_renderer_s {
int (*set_font) (osd_object_t *osd, const char *fontname, int size);
+ /*
+ * set encoding of text
+ *
+ * NULL ... no conversion (iso-8859-1)
+ * "" ... locale encoding
+ */
+ int (*set_encoding) (osd_object_t *osd, const char *encoding);
/*
- * render text on x,y position (8 bits version)
+ * render text in current encoding on x,y position
* no \n yet
*
* The text is assigned the colors starting at the index specified by
@@ -158,7 +174,7 @@ struct osd_renderer_s {
* Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices.
*/
int (*render_text) (osd_object_t *osd, int x1, int y1,
- const char *text, const char *encoding, int color_base);
+ const char *text, int color_base);
/*
* get width and height of how text will be renderized
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index c026bbca1..3f0f7b5df 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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_interface.c,v 1.57 2003/08/26 21:18:32 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.58 2003/09/18 18:14:51 valtri Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -599,6 +599,7 @@ const char *xine_get_meta_info (xine_stream_t *stream, int info) {
xine_osd_t *xine_osd_new(xine_stream_t *stream, int x, int y, int width, int height) {
xine_osd_t *this = (xine_osd_t *)stream->osd_renderer->new_object(stream->osd_renderer, width, height);
this->osd.renderer->set_position(&this->osd, x, y);
+ this->osd.renderer->set_encoding(&this->osd, "");
return this;
}
@@ -622,7 +623,7 @@ void xine_osd_draw_rect(xine_osd_t *this, int x1, int y1, int x2, int y2, int co
}
void xine_osd_draw_text(xine_osd_t *this, int x1, int y1, const char *text, int color_base) {
- this->osd.renderer->render_text(&this->osd, x1, y1, text, NULL, color_base);
+ this->osd.renderer->render_text(&this->osd, x1, y1, text, color_base);
}
void xine_osd_get_text_size(xine_osd_t *this, const char *text, int *width, int *height) {