diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2005-12-06 13:27:15 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2005-12-06 13:27:15 +0000 |
commit | b0fee17d6e1a463dcd84568e5997663b69488998 (patch) | |
tree | fffce775c4d1636a8bbc9e97669aa99b9378fc15 /firmware/drivers/lcd-h100.c | |
parent | 01917ec9809f1abff87cb372b700fc09476d343e (diff) | |
download | rockbox-b0fee17d6e1a463dcd84568e5997663b69488998.tar.gz rockbox-b0fee17d6e1a463dcd84568e5997663b69488998.zip |
waiting is over: initial unicode commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8169 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-h100.c')
-rw-r--r-- | firmware/drivers/lcd-h100.c | 18 |
1 files changed, 9 insertions, 9 deletions
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 @@ | |||
28 | #include "debug.h" | 28 | #include "debug.h" |
29 | #include "system.h" | 29 | #include "system.h" |
30 | #include "font.h" | 30 | #include "font.h" |
31 | #include "rbunicode.h" | ||
31 | #include "bidi.h" | 32 | #include "bidi.h" |
32 | 33 | ||
33 | /*** definitions ***/ | 34 | /*** definitions ***/ |
@@ -1014,13 +1015,13 @@ void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) | |||
1014 | /* put a string at a given pixel position, skipping first ofs pixel columns */ | 1015 | /* put a string at a given pixel position, skipping first ofs pixel columns */ |
1015 | static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) | 1016 | static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) |
1016 | { | 1017 | { |
1017 | int ch; | 1018 | unsigned short ch; |
1019 | unsigned short *ucs; | ||
1018 | struct font* pf = font_get(curfont); | 1020 | struct font* pf = font_get(curfont); |
1019 | 1021 | ||
1020 | if (bidi_support_enabled) | 1022 | ucs = bidi_l2v(str, 1); |
1021 | str = bidi_l2v(str, 1); | ||
1022 | 1023 | ||
1023 | while ((ch = *str++) != '\0' && x < LCD_WIDTH) | 1024 | while ((ch = *ucs++) != 0 && x < LCD_WIDTH) |
1024 | { | 1025 | { |
1025 | int width; | 1026 | int width; |
1026 | const unsigned char *bits; | 1027 | const unsigned char *bits; |
@@ -1031,7 +1032,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) | |||
1031 | ch -= pf->firstchar; | 1032 | ch -= pf->firstchar; |
1032 | 1033 | ||
1033 | /* get proportional width and glyph bits */ | 1034 | /* get proportional width and glyph bits */ |
1034 | width = pf->width ? pf->width[ch] : pf->maxwidth; | 1035 | width = font_get_width(pf,ch); |
1035 | 1036 | ||
1036 | if (ofs > width) | 1037 | if (ofs > width) |
1037 | { | 1038 | { |
@@ -1039,8 +1040,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) | |||
1039 | continue; | 1040 | continue; |
1040 | } | 1041 | } |
1041 | 1042 | ||
1042 | bits = pf->bits + (pf->offset ? | 1043 | bits = font_get_bits(pf, ch); |
1043 | pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch)); | ||
1044 | 1044 | ||
1045 | lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); | 1045 | lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); |
1046 | 1046 | ||
@@ -1069,7 +1069,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
1069 | return; | 1069 | return; |
1070 | 1070 | ||
1071 | lcd_getstringsize(str, &w, &h); | 1071 | lcd_getstringsize(str, &w, &h); |
1072 | xpos = xmargin + x*w / strlen((char *)str); | 1072 | xpos = xmargin + x*w / utf8length((char *)str); |
1073 | ypos = ymargin + y*h; | 1073 | ypos = ymargin + y*h; |
1074 | lcd_putsxy(xpos, ypos, str); | 1074 | lcd_putsxy(xpos, ypos, str); |
1075 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 1075 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
@@ -1178,7 +1178,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
1178 | end = strchr(s->line, '\0'); | 1178 | end = strchr(s->line, '\0'); |
1179 | strncpy(end, (char *)string, LCD_WIDTH/2); | 1179 | strncpy(end, (char *)string, LCD_WIDTH/2); |
1180 | 1180 | ||
1181 | s->len = strlen((char *)string); | 1181 | s->len = utf8length((char *)string); |
1182 | s->offset = 0; | 1182 | s->offset = 0; |
1183 | s->startx = x; | 1183 | s->startx = x; |
1184 | s->backward = false; | 1184 | s->backward = false; |