summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-h100-remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-h100-remote.c')
-rw-r--r--firmware/drivers/lcd-h100-remote.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index 33a8b3790d..a2fe63ee97 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -29,6 +29,7 @@
29#include "debug.h" 29#include "debug.h"
30#include "system.h" 30#include "system.h"
31#include "font.h" 31#include "font.h"
32#include "rbunicode.h"
32#include "bidi.h" 33#include "bidi.h"
33 34
34/*** definitions ***/ 35/*** definitions ***/
@@ -1091,13 +1092,13 @@ void lcd_remote_bitmap(const unsigned char *src, int x, int y, int width,
1091/* put a string at a given pixel position, skipping first ofs pixel columns */ 1092/* put a string at a given pixel position, skipping first ofs pixel columns */
1092static void lcd_remote_putsxyofs(int x, int y, int ofs, const unsigned char *str) 1093static void lcd_remote_putsxyofs(int x, int y, int ofs, const unsigned char *str)
1093{ 1094{
1094 int ch; 1095 unsigned short ch;
1096 unsigned short *ucs;
1095 struct font* pf = font_get(curfont); 1097 struct font* pf = font_get(curfont);
1096 1098
1097 if (bidi_support_enabled) 1099 ucs = bidi_l2v(str, 1);
1098 str = bidi_l2v(str, 1);
1099 1100
1100 while ((ch = *str++) != '\0' && x < LCD_REMOTE_WIDTH) 1101 while ((ch = *ucs++) != 0 && x < LCD_REMOTE_WIDTH)
1101 { 1102 {
1102 int width; 1103 int width;
1103 const unsigned char *bits; 1104 const unsigned char *bits;
@@ -1108,7 +1109,7 @@ static void lcd_remote_putsxyofs(int x, int y, int ofs, const unsigned char *str
1108 ch -= pf->firstchar; 1109 ch -= pf->firstchar;
1109 1110
1110 /* get proportional width and glyph bits */ 1111 /* get proportional width and glyph bits */
1111 width = pf->width ? pf->width[ch] : pf->maxwidth; 1112 width = font_get_width(pf, ch);
1112 1113
1113 if (ofs > width) 1114 if (ofs > width)
1114 { 1115 {
@@ -1116,8 +1117,7 @@ static void lcd_remote_putsxyofs(int x, int y, int ofs, const unsigned char *str
1116 continue; 1117 continue;
1117 } 1118 }
1118 1119
1119 bits = pf->bits + (pf->offset ? 1120 bits = font_get_bits(pf, ch);
1120 pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
1121 1121
1122 lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, 1122 lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs,
1123 pf->height); 1123 pf->height);
@@ -1153,7 +1153,7 @@ void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
1153 return; 1153 return;
1154 1154
1155 lcd_remote_getstringsize(str, &w, &h); 1155 lcd_remote_getstringsize(str, &w, &h);
1156 xpos = xmargin + x*w / strlen((char *)str); 1156 xpos = xmargin + x*w / utf8length((char *)str);
1157 ypos = ymargin + y*h; 1157 ypos = ymargin + y*h;
1158 lcd_remote_putsxy(xpos, ypos, str); 1158 lcd_remote_putsxy(xpos, ypos, str);
1159 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); 1159 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -1256,7 +1256,7 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int
1256 end = strchr(s->line, '\0'); 1256 end = strchr(s->line, '\0');
1257 strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2); 1257 strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2);
1258 1258
1259 s->len = strlen((char *)string); 1259 s->len = utf8length((char *)string);
1260 s->offset = 0; 1260 s->offset = 0;
1261 s->startx = x; 1261 s->startx = x;
1262 s->backward = false; 1262 s->backward = false;
@@ -1323,9 +1323,11 @@ static void scroll_thread(void)
1323 } 1323 }
1324 } 1324 }
1325 else { 1325 else {
1326 /* scroll forward the whole time */ 1326 /* pause at beginning of line */
1327 if (s->offset >= s->width) 1327 if (s->offset >= s->width) {
1328 s->offset %= s->width; 1328 s->offset = 0;
1329 s->start_tick = current_tick + scroll_delay * 2;
1330 }
1329 } 1331 }
1330 1332
1331 lastmode = drawmode; 1333 lastmode = drawmode;