Make the greylib text output functions handle unicode. Fixes non-working umlauts etc in greyscale pictureflow.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19607 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
11d5350977
commit
9bf20486a8
1 changed files with 6 additions and 9 deletions
|
@ -534,20 +534,18 @@ void grey_gray_bitmap(const unsigned char *src, int x, int y, int width,
|
||||||
void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
|
void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
unsigned short *ucs;
|
||||||
struct font* pf = _grey_info.rb->font_get(_grey_info.curfont);
|
struct font* pf = _grey_info.rb->font_get(_grey_info.curfont);
|
||||||
|
|
||||||
|
ucs = _grey_info.rb->bidi_l2v(str, 1);
|
||||||
|
|
||||||
while ((ch = *str++) != '\0' && x < _grey_info.width)
|
while ((ch = *ucs++) != 0 && x < _grey_info.width)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
const unsigned char *bits;
|
const unsigned char *bits;
|
||||||
|
|
||||||
/* check input range */
|
|
||||||
if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
|
|
||||||
ch = pf->defaultchar;
|
|
||||||
ch -= pf->firstchar;
|
|
||||||
|
|
||||||
/* get proportional width and glyph bits */
|
/* get proportional width and glyph bits */
|
||||||
width = pf->width ? pf->width[ch] : pf->maxwidth;
|
width = _grey_info.rb->font_get_width(pf, ch);
|
||||||
|
|
||||||
if (ofs > width)
|
if (ofs > width)
|
||||||
{
|
{
|
||||||
|
@ -555,8 +553,7 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bits = pf->bits + (pf->offset ?
|
bits = _grey_info.rb->font_get_bits(pf, ch);
|
||||||
pf->offset[ch] : (((pf->height + 7) >> 3) * pf->maxwidth * ch));
|
|
||||||
|
|
||||||
grey_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
|
grey_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue