diff options
Diffstat (limited to 'firmware/drivers/lcd-player.c')
-rw-r--r-- | firmware/drivers/lcd-player.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 566c868d7f..d01ec3447f 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "system.h" | 31 | #include "system.h" |
32 | #include "font.h" | 32 | #include "font.h" |
33 | #include "lcd-player-charset.h" | 33 | #include "lcd-player-charset.h" |
34 | #include "rbunicode.h" | ||
34 | 35 | ||
35 | /*** definitions ***/ | 36 | /*** definitions ***/ |
36 | 37 | ||
@@ -323,9 +324,24 @@ static void lcd_puts_cont_scroll(int x, int y, const unsigned char *string) | |||
323 | } | 324 | } |
324 | void lcd_puts(int x, int y, const unsigned char *string) | 325 | void lcd_puts(int x, int y, const unsigned char *string) |
325 | { | 326 | { |
327 | int i=0; | ||
328 | unsigned short ucs; | ||
329 | const unsigned char *utf8 = string; | ||
330 | unsigned char tmp[12]; | ||
331 | |||
332 | while (*utf8 && i<11) { | ||
333 | utf8 = utf8decode(utf8, &ucs); | ||
334 | if (ucs < 256) | ||
335 | tmp[i++] = ucs; | ||
336 | else | ||
337 | tmp[i++] = '?'; | ||
338 | } | ||
339 | |||
340 | tmp[i] = 0; | ||
341 | |||
326 | DEBUGF("lcd_puts(%d, %d) -> ", x, y); | 342 | DEBUGF("lcd_puts(%d, %d) -> ", x, y); |
327 | scroll[y].mode=SCROLL_MODE_OFF; | 343 | scroll[y].mode=SCROLL_MODE_OFF; |
328 | return lcd_puts_cont_scroll(x, y, string); | 344 | return lcd_puts_cont_scroll(x, y, tmp); |
329 | } | 345 | } |
330 | 346 | ||
331 | void lcd_put_cursor(int x, int y, char cursor_char) | 347 | void lcd_put_cursor(int x, int y, char cursor_char) |
@@ -627,14 +643,28 @@ void lcd_bidir_scroll(int percent) | |||
627 | void lcd_puts_scroll(int x, int y, const unsigned char* string ) | 643 | void lcd_puts_scroll(int x, int y, const unsigned char* string ) |
628 | { | 644 | { |
629 | struct scrollinfo* s; | 645 | struct scrollinfo* s; |
630 | int i; | 646 | int i=0; |
647 | unsigned short ucs; | ||
648 | const unsigned char *utf8 = string; | ||
649 | unsigned char tmp[utf8length(string)+1]; | ||
650 | |||
651 | while (*utf8) { | ||
652 | utf8 = utf8decode(utf8, &ucs); | ||
653 | if (ucs < 256) | ||
654 | tmp[i++] = ucs; | ||
655 | else | ||
656 | tmp[i++] = '?'; | ||
657 | } | ||
658 | |||
659 | tmp[i] = 0; | ||
660 | |||
631 | 661 | ||
632 | DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string); | 662 | DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string); |
633 | 663 | ||
634 | s = &scroll[y]; | 664 | s = &scroll[y]; |
635 | 665 | ||
636 | lcd_puts_cont_scroll(x,y,string); | 666 | lcd_puts_cont_scroll(x,y,tmp); |
637 | s->textlen = strlen(string); | 667 | s->textlen = strlen(tmp); |
638 | 668 | ||
639 | if ( s->textlen > 11-x ) { | 669 | if ( s->textlen > 11-x ) { |
640 | s->mode = SCROLL_MODE_RUN; | 670 | s->mode = SCROLL_MODE_RUN; |
@@ -649,7 +679,7 @@ void lcd_puts_scroll(int x, int y, const unsigned char* string ) | |||
649 | s->jump_scroll_steps=11-x; | 679 | s->jump_scroll_steps=11-x; |
650 | s->jump_scroll=jump_scroll; | 680 | s->jump_scroll=jump_scroll; |
651 | } | 681 | } |
652 | strncpy(s->text,string,sizeof s->text); | 682 | strncpy(s->text,tmp,sizeof s->text); |
653 | s->turn_offset=-1; | 683 | s->turn_offset=-1; |
654 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { | 684 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { |
655 | s->turn_offset=s->textlen+x-11; | 685 | s->turn_offset=s->textlen+x-11; |