summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/viewport.c5
-rw-r--r--apps/menus/time_menu.c2
-rw-r--r--apps/plugins/lib/pluginlib_touchscreen.c3
-rw-r--r--firmware/drivers/lcd-bitmap-common.c15
-rw-r--r--firmware/export/lcd.h1
5 files changed, 10 insertions, 16 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 0b5441e02b..b91c7441dd 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -225,9 +225,7 @@ static bool is_theme_enabled(enum screen_type screen)
225int viewport_get_nb_lines(const struct viewport *vp) 225int viewport_get_nb_lines(const struct viewport *vp)
226{ 226{
227#ifdef HAVE_LCD_BITMAP 227#ifdef HAVE_LCD_BITMAP
228 if (!vp->line_height) 228 return vp->height/font_get(vp->font)->height;
229 return vp->height/font_get(vp->font)->height;
230 return vp->height/vp->line_height;
231#else 229#else
232 (void)vp; 230 (void)vp;
233 return 2; 231 return 2;
@@ -322,7 +320,6 @@ void viewport_set_fullscreen(struct viewport *vp,
322 set_default_align_flags(vp); 320 set_default_align_flags(vp);
323#endif 321#endif
324 vp->font = screens[screen].getuifont(); 322 vp->font = screens[screen].getuifont();
325 vp->line_height = 0; /* calculate from font height */
326 vp->drawmode = DRMODE_SOLID; 323 vp->drawmode = DRMODE_SOLID;
327#if LCD_DEPTH > 1 324#if LCD_DEPTH > 1
328#ifdef HAVE_REMOTE_LCD 325#ifdef HAVE_REMOTE_LCD
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c
index 1eb4bd68cc..9ef4f7323c 100644
--- a/apps/menus/time_menu.c
+++ b/apps/menus/time_menu.c
@@ -265,7 +265,7 @@ int time_screen(void* ignored)
265 /* force time to be drawn centered */ 265 /* force time to be drawn centered */
266 clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER; 266 clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER;
267 267
268 font_h = clock_vps[i].line_height ?: (int)font_get(clock_vps[i].font)->height; 268 font_h = font_get(clock_vps[i].font)->height;
269 nb_lines -= 2; /* at least 2 lines for menu */ 269 nb_lines -= 2; /* at least 2 lines for menu */
270 if (nb_lines > 4) 270 if (nb_lines > 4)
271 nb_lines = 4; 271 nb_lines = 4;
diff --git a/apps/plugins/lib/pluginlib_touchscreen.c b/apps/plugins/lib/pluginlib_touchscreen.c
index 095750740e..5903b7c7a9 100644
--- a/apps/plugins/lib/pluginlib_touchscreen.c
+++ b/apps/plugins/lib/pluginlib_touchscreen.c
@@ -140,8 +140,7 @@ void touchbutton_draw(struct touchbutton *data, int num_buttons) {
140 */ 140 */
141 lcd->set_viewport(&data[i].vp); 141 lcd->set_viewport(&data[i].vp);
142 142
143 /* Set line_height to height, then it'll center for us */ 143 /* TODO: Center text vert*/
144 data[i].vp.line_height = data[i].vp.height;
145 data[i].vp.flags |= VP_FLAG_ALIGN_CENTER; 144 data[i].vp.flags |= VP_FLAG_ALIGN_CENTER;
146 145
147 /* If the width offset was 0, use a scrolling puts, else center and 146 /* If the width offset was 0, use a scrolling puts, else center and
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 330639fd87..97921c6347 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -387,12 +387,11 @@ void LCDFN(putsxyf)(int x, int y, const unsigned char *fmt, ...)
387 387
388static void LCDFN(putsxyofs_style)(int xpos, int ypos, 388static void LCDFN(putsxyofs_style)(int xpos, int ypos,
389 const unsigned char *str, int style, 389 const unsigned char *str, int style,
390 int h, int offset) 390 int offset)
391{ 391{
392 int lastmode = current_vp->drawmode; 392 int lastmode = current_vp->drawmode;
393 int text_ypos = ypos; 393 int text_ypos = ypos;
394 int line_height = font_get(current_vp->font)->height; 394 int h = font_get(current_vp->font)->height;
395 text_ypos += h/2 - line_height/2; /* center the text in the line */
396 395
397 if ((style & STYLE_MODE_MASK) == STYLE_NONE) { 396 if ((style & STYLE_MODE_MASK) == STYLE_NONE) {
398 if (str[0]) 397 if (str[0])
@@ -452,7 +451,7 @@ static void LCDFN(putsofs_style)(int x, int y, const unsigned char *str,
452 if(!str) 451 if(!str)
453 return; 452 return;
454 453
455 h = current_vp->line_height ?: (int)font_get(current_vp->font)->height; 454 h = font_get(current_vp->font)->height;
456 if ((style&STYLE_XY_PIXELS) == 0) 455 if ((style&STYLE_XY_PIXELS) == 0)
457 { 456 {
458 xpos = x * LCDFN(getstringsize)(" ", NULL, NULL); 457 xpos = x * LCDFN(getstringsize)(" ", NULL, NULL);
@@ -464,7 +463,7 @@ static void LCDFN(putsofs_style)(int x, int y, const unsigned char *str,
464 ypos = y; 463 ypos = y;
465 } 464 }
466 LCDFN(scroll_stop_viewport_rect)(current_vp, xpos, ypos, current_vp->width - xpos, h); 465 LCDFN(scroll_stop_viewport_rect)(current_vp, xpos, ypos, current_vp->width - xpos, h);
467 LCDFN(putsxyofs_style)(xpos, ypos+y_offset, str, style, h, x_offset); 466 LCDFN(putsxyofs_style)(xpos, ypos+y_offset, str, style, x_offset);
468} 467}
469 468
470void LCDFN(puts)(int x, int y, const unsigned char *str) 469void LCDFN(puts)(int x, int y, const unsigned char *str)
@@ -501,7 +500,7 @@ static struct scrollinfo* find_scrolling_line(int x, int y)
501 500
502void LCDFN(scroll_fn)(struct scrollinfo* s) 501void LCDFN(scroll_fn)(struct scrollinfo* s)
503{ 502{
504 LCDFN(putsxyofs_style)(s->x, s->y, s->line, s->style, s->height, s->offset); 503 LCDFN(putsxyofs_style)(s->x, s->y, s->line, s->style, s->offset);
505} 504}
506 505
507static void LCDFN(puts_scroll_worker)(int x, int y, const unsigned char *string, 506static void LCDFN(puts_scroll_worker)(int x, int y, const unsigned char *string,
@@ -521,7 +520,7 @@ static void LCDFN(puts_scroll_worker)(int x, int y, const unsigned char *string,
521 /* prepare rectangle for scrolling. x and y must be calculated early 520 /* prepare rectangle for scrolling. x and y must be calculated early
522 * for find_scrolling_line() to work */ 521 * for find_scrolling_line() to work */
523 cwidth = font_get(current_vp->font)->maxwidth; 522 cwidth = font_get(current_vp->font)->maxwidth;
524 height = current_vp->line_height ?: (int)font_get(current_vp->font)->height; 523 height = font_get(current_vp->font)->height;
525 y = y * (linebased ? height : 1) + y_offset; 524 y = y * (linebased ? height : 1) + y_offset;
526 x = x * (linebased ? cwidth : 1); 525 x = x * (linebased ? cwidth : 1);
527 width = current_vp->width - x; 526 width = current_vp->width - x;
@@ -535,7 +534,7 @@ static void LCDFN(puts_scroll_worker)(int x, int y, const unsigned char *string,
535 if (restart) { 534 if (restart) {
536 /* remove any previously scrolling line at the same location */ 535 /* remove any previously scrolling line at the same location */
537 LCDFN(scroll_stop_viewport_rect)(current_vp, x, y, width, height); 536 LCDFN(scroll_stop_viewport_rect)(current_vp, x, y, width, height);
538 LCDFN(putsxyofs_style)(x, y, string, style, height, x_offset); 537 LCDFN(putsxyofs_style)(x, y, string, style, x_offset);
539 538
540 if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) 539 if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES))
541 return; 540 return;
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index afdc5cf45e..bdeddf0b52 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -43,7 +43,6 @@ struct viewport {
43#ifdef HAVE_LCD_BITMAP 43#ifdef HAVE_LCD_BITMAP
44 int flags; 44 int flags;
45 int font; 45 int font;
46 int line_height; /* 0 for using font height */
47 int drawmode; 46 int drawmode;
48#endif 47#endif
49#if LCD_DEPTH > 1 48#if LCD_DEPTH > 1