diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/diacritic.c | 12 | ||||
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 67 | ||||
-rw-r--r-- | firmware/scroll_engine.c | 10 |
3 files changed, 86 insertions, 3 deletions
diff --git a/firmware/common/diacritic.c b/firmware/common/diacritic.c index 563028cab8..92c2400203 100644 --- a/firmware/common/diacritic.c +++ b/firmware/common/diacritic.c @@ -194,7 +194,7 @@ static const struct diac_range diac_ranges[] = }; #define MRU_MAX_LEN 32 - +#ifndef BOOTLOADER bool is_diacritic(const unsigned short char_code, bool *is_rtl) { static uint8_t mru_len = 0; @@ -248,4 +248,12 @@ Found: return (char_code < diac->base + (info & DIAC_CNT)); } - +#else /*BOOTLOADER*/ +inline bool is_diacritic(const unsigned short char_code, bool *is_rtl) +{ + (void)char_code; + if (is_rtl) + *is_rtl = false; + return false; +} +#endif /* ndef BOOTLOADER*/ diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 22430d4e50..8c38e513c6 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c @@ -118,6 +118,7 @@ void LCDFN(update_viewport_rect)(int x, int y, int width, int height) LCDFN(update_rect)(current_vp->x + x, current_vp->y + y, width, height); } +#ifndef BOOTLOADER /* put a string at a given pixel position, skipping first ofs pixel columns */ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) { @@ -257,6 +258,72 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) } font_lock(current_vp->font, false); } +#else /* BOOTLOADER */ +/* put a string at a given pixel position, skipping first ofs pixel columns */ +static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) +{ + unsigned short *ucs; + struct font* pf = font_get(current_vp->font); + int vp_flags = current_vp->flags; + const unsigned char *bits; + int width; + + if ((vp_flags & VP_FLAG_ALIGNMENT_MASK) != 0) + { + int w; + + LCDFN(getstringsize)(str, &w, NULL); + /* center takes precedence */ + if (vp_flags & VP_FLAG_ALIGN_CENTER) + { + x = ((current_vp->width - w)/ 2) + x; + if (x < 0) + x = 0; + } + else + { + x = current_vp->width - w - x; + x += ofs; + ofs = 0; + } + } + + /* allow utf but no diacritics or rtl lang */ + for (ucs = bidi_l2v(str, 1); *ucs; ucs++) + { + const unsigned short next_ch = ucs[1]; + + if (x >= current_vp->width) + break; + + /* Get proportional width and glyph bits */ + width = font_get_width(pf, *ucs); + + if (ofs > width) + { + ofs -= width; + continue; + } + + bits = font_get_bits(pf, *ucs); + +#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) + if (pf->depth) + lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y, + width - ofs, pf->height); + else +#endif + LCDFN(mono_bitmap_part)(bits, ofs, 0, width, x, + y, width - ofs, pf->height); + if (next_ch) + { + x += width - ofs; + ofs = 0; + } + } +} +#endif + /*** pixel oriented text output ***/ diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index b584345a9a..91f9d1f868 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c @@ -52,7 +52,6 @@ static const char scroll_tick_table[18] = { }; static void scroll_thread(void); -static char scroll_stack[DEFAULT_STACK_SIZE*3]; static const char scroll_name[] = "scroll"; #include "drivers/lcd-scroll.c" @@ -195,8 +194,11 @@ static void scroll_thread(void) } #endif /* HAVE_REMOTE_LCD */ + +#ifndef BOOTLOADER void scroll_init(void) { + static char scroll_stack[DEFAULT_STACK_SIZE*3]; #ifdef HAVE_REMOTE_LCD queue_init(&scroll_queue, true); #endif @@ -205,3 +207,9 @@ void scroll_init(void) IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU)); } +#else +void scroll_init(void) +{ + /* DUMMY */ +} +#endif /* ndef BOOTLOADER*/ |