From b0fee17d6e1a463dcd84568e5997663b69488998 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Tue, 6 Dec 2005 13:27:15 +0000 Subject: waiting is over: initial unicode commit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8169 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-h100.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'firmware/drivers/lcd-h100.c') diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c index ba959d23de..1199bf04a1 100644 --- a/firmware/drivers/lcd-h100.c +++ b/firmware/drivers/lcd-h100.c @@ -28,6 +28,7 @@ #include "debug.h" #include "system.h" #include "font.h" +#include "rbunicode.h" #include "bidi.h" /*** definitions ***/ @@ -1014,13 +1015,13 @@ void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) /* put a string at a given pixel position, skipping first ofs pixel columns */ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) { - int ch; + unsigned short ch; + unsigned short *ucs; struct font* pf = font_get(curfont); - if (bidi_support_enabled) - str = bidi_l2v(str, 1); + ucs = bidi_l2v(str, 1); - while ((ch = *str++) != '\0' && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < LCD_WIDTH) { int width; const unsigned char *bits; @@ -1031,7 +1032,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) ch -= pf->firstchar; /* get proportional width and glyph bits */ - width = pf->width ? pf->width[ch] : pf->maxwidth; + width = font_get_width(pf,ch); if (ofs > width) { @@ -1039,8 +1040,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) continue; } - bits = pf->bits + (pf->offset ? - pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch)); + bits = font_get_bits(pf, ch); lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); @@ -1069,7 +1069,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) return; lcd_getstringsize(str, &w, &h); - xpos = xmargin + x*w / strlen((char *)str); + xpos = xmargin + x*w / utf8length((char *)str); ypos = ymargin + y*h; lcd_putsxy(xpos, ypos, str); drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); @@ -1178,7 +1178,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) end = strchr(s->line, '\0'); strncpy(end, (char *)string, LCD_WIDTH/2); - s->len = strlen((char *)string); + s->len = utf8length((char *)string); s->offset = 0; s->startx = x; s->backward = false; -- cgit v1.2.3