[MPlayer-dev-eng] [Bug] Can't display two-byte CJK characters in OSD menu

Bob Cheng hdrhg at hotmail.com
Sat Mar 29 03:10:48 CET 2003


Hi:

  If I have a file named XY.avi (X and Y are two-byte Chinese characters), 
it will be shown as ____.avi (four underlines) on OSD menu->Open.

  It appeared to be the wrong way to render text byte-by-byte in 
libmenu/menu.c.
But I am not familiar with FreeType so I have no idea how to fix it. Any 
suggestions?


#ifdef HAVE_FREETYPE
#define render_txt(t)  { char* p = t;  while(*p) 
render_one_glyph(vo_font,*p++);
}
#else
#define render_txt(t)
#endif

void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) {
  draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
  int font;

  if(!draw_alpha) {
    printf("Unsupported outformat !!!!\n");
    return;
  }

  render_txt(txt);

  while (*txt) {
    unsigned char c=*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],
                 vo_font->pic_a[font]->bmp+vo_font->start[c],
                 vo_font->pic_a[font]->w,
                 mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3),
                 mpi->stride[0]);
    x+=vo_font->width[c]+vo_font->charspace;
  }
}



_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail



More information about the MPlayer-dev-eng mailing list