summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/diacritic.c12
-rw-r--r--firmware/drivers/lcd-bitmap-common.c67
-rw-r--r--firmware/scroll_engine.c10
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[] =
194}; 194};
195 195
196#define MRU_MAX_LEN 32 196#define MRU_MAX_LEN 32
197 197#ifndef BOOTLOADER
198bool is_diacritic(const unsigned short char_code, bool *is_rtl) 198bool is_diacritic(const unsigned short char_code, bool *is_rtl)
199{ 199{
200 static uint8_t mru_len = 0; 200 static uint8_t mru_len = 0;
@@ -248,4 +248,12 @@ Found:
248 248
249 return (char_code < diac->base + (info & DIAC_CNT)); 249 return (char_code < diac->base + (info & DIAC_CNT));
250} 250}
251 251#else /*BOOTLOADER*/
252inline bool is_diacritic(const unsigned short char_code, bool *is_rtl)
253{
254 (void)char_code;
255 if (is_rtl)
256 *is_rtl = false;
257 return false;
258}
259#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)
118 LCDFN(update_rect)(current_vp->x + x, current_vp->y + y, width, height); 118 LCDFN(update_rect)(current_vp->x + x, current_vp->y + y, width, height);
119} 119}
120 120
121#ifndef BOOTLOADER
121/* put a string at a given pixel position, skipping first ofs pixel columns */ 122/* put a string at a given pixel position, skipping first ofs pixel columns */
122static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) 123static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
123{ 124{
@@ -257,6 +258,72 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
257 } 258 }
258 font_lock(current_vp->font, false); 259 font_lock(current_vp->font, false);
259} 260}
261#else /* BOOTLOADER */
262/* put a string at a given pixel position, skipping first ofs pixel columns */
263static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
264{
265 unsigned short *ucs;
266 struct font* pf = font_get(current_vp->font);
267 int vp_flags = current_vp->flags;
268 const unsigned char *bits;
269 int width;
270
271 if ((vp_flags & VP_FLAG_ALIGNMENT_MASK) != 0)
272 {
273 int w;
274
275 LCDFN(getstringsize)(str, &w, NULL);
276 /* center takes precedence */
277 if (vp_flags & VP_FLAG_ALIGN_CENTER)
278 {
279 x = ((current_vp->width - w)/ 2) + x;
280 if (x < 0)
281 x = 0;
282 }
283 else
284 {
285 x = current_vp->width - w - x;
286 x += ofs;
287 ofs = 0;
288 }
289 }
290
291 /* allow utf but no diacritics or rtl lang */
292 for (ucs = bidi_l2v(str, 1); *ucs; ucs++)
293 {
294 const unsigned short next_ch = ucs[1];
295
296 if (x >= current_vp->width)
297 break;
298
299 /* Get proportional width and glyph bits */
300 width = font_get_width(pf, *ucs);
301
302 if (ofs > width)
303 {
304 ofs -= width;
305 continue;
306 }
307
308 bits = font_get_bits(pf, *ucs);
309
310#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
311 if (pf->depth)
312 lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y,
313 width - ofs, pf->height);
314 else
315#endif
316 LCDFN(mono_bitmap_part)(bits, ofs, 0, width, x,
317 y, width - ofs, pf->height);
318 if (next_ch)
319 {
320 x += width - ofs;
321 ofs = 0;
322 }
323 }
324}
325#endif
326
260 327
261/*** pixel oriented text output ***/ 328/*** pixel oriented text output ***/
262 329
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] = {
52}; 52};
53 53
54static void scroll_thread(void); 54static void scroll_thread(void);
55static char scroll_stack[DEFAULT_STACK_SIZE*3];
56static const char scroll_name[] = "scroll"; 55static const char scroll_name[] = "scroll";
57 56
58#include "drivers/lcd-scroll.c" 57#include "drivers/lcd-scroll.c"
@@ -195,8 +194,11 @@ static void scroll_thread(void)
195} 194}
196#endif /* HAVE_REMOTE_LCD */ 195#endif /* HAVE_REMOTE_LCD */
197 196
197
198#ifndef BOOTLOADER
198void scroll_init(void) 199void scroll_init(void)
199{ 200{
201 static char scroll_stack[DEFAULT_STACK_SIZE*3];
200#ifdef HAVE_REMOTE_LCD 202#ifdef HAVE_REMOTE_LCD
201 queue_init(&scroll_queue, true); 203 queue_init(&scroll_queue, true);
202#endif 204#endif
@@ -205,3 +207,9 @@ void scroll_init(void)
205 IF_PRIO(, PRIORITY_USER_INTERFACE) 207 IF_PRIO(, PRIORITY_USER_INTERFACE)
206 IF_COP(, CPU)); 208 IF_COP(, CPU));
207} 209}
210#else
211void scroll_init(void)
212{
213 /* DUMMY */
214}
215#endif /* ndef BOOTLOADER*/