summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-16bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r--firmware/drivers/lcd-16bit.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index a4ae6cd553..582050c878 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -30,6 +30,7 @@
30#include "debug.h" 30#include "debug.h"
31#include "system.h" 31#include "system.h"
32#include "font.h" 32#include "font.h"
33#include "rbunicode.h"
33#include "bidi.h" 34#include "bidi.h"
34 35
35#define SCROLLABLE_LINES 26 36#define SCROLLABLE_LINES 26
@@ -542,13 +543,13 @@ void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
542/* put a string at a given pixel position, skipping first ofs pixel columns */ 543/* put a string at a given pixel position, skipping first ofs pixel columns */
543static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) 544static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
544{ 545{
545 int ch; 546 unsigned short ch;
547 unsigned short *ucs;
546 struct font* pf = font_get(curfont); 548 struct font* pf = font_get(curfont);
547 549
548 if (bidi_support_enabled) 550 ucs = bidi_l2v(str, 1);
549 str = bidi_l2v(str, 1);
550 551
551 while ((ch = *str++) != '\0' && x < LCD_WIDTH) 552 while ((ch = *ucs++) != 0 && x < LCD_WIDTH)
552 { 553 {
553 int width; 554 int width;
554 const unsigned char *bits; 555 const unsigned char *bits;
@@ -559,7 +560,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
559 ch -= pf->firstchar; 560 ch -= pf->firstchar;
560 561
561 /* get proportional width and glyph bits */ 562 /* get proportional width and glyph bits */
562 width = pf->width ? pf->width[ch] : pf->maxwidth; 563 width = font_get_width(pf,ch);
563 564
564 if (ofs > width) 565 if (ofs > width)
565 { 566 {
@@ -567,8 +568,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
567 continue; 568 continue;
568 } 569 }
569 570
570 bits = pf->bits + (pf->offset ? 571 bits = font_get_bits(pf, ch);
571 pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
572 572
573 lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); 573 lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
574 574
@@ -597,7 +597,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style)
597 return; 597 return;
598 598
599 lcd_getstringsize(str, &w, &h); 599 lcd_getstringsize(str, &w, &h);
600 xpos = xmargin + x*w / strlen(str); 600 xpos = xmargin + x*w / utf8length(str);
601 ypos = ymargin + y*h; 601 ypos = ymargin + y*h;
602 lcd_putsxy(xpos, ypos, str); 602 lcd_putsxy(xpos, ypos, str);
603 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); 603 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -707,7 +707,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style)
707 end = strchr(s->line, '\0'); 707 end = strchr(s->line, '\0');
708 strncpy(end, string, LCD_WIDTH/2); 708 strncpy(end, string, LCD_WIDTH/2);
709 709
710 s->len = strlen(string); 710 s->len = utf8length(string);
711 s->offset = 0; 711 s->offset = 0;
712 s->startx = x; 712 s->startx = x;
713 s->backward = false; 713 s->backward = false;
@@ -765,9 +765,11 @@ static void scroll_thread(void)
765 } 765 }
766 } 766 }
767 else { 767 else {
768 /* scroll forward the whole time */ 768 /* pause at beginning of line */
769 if (s->offset >= s->width) 769 if (s->offset >= s->width) {
770 s->offset %= s->width; 770 s->offset = 0;
771 s->start_tick = current_tick + scroll_delay * 2;
772 }
771 } 773 }
772 774
773 lastmode = drawmode; 775 lastmode = drawmode;