summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-bitmap-common.c9
-rw-r--r--firmware/export/lcd.h8
2 files changed, 13 insertions, 4 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 38fa55b02d..5bf4706c59 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -82,15 +82,20 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
82 unsigned short ch; 82 unsigned short ch;
83 unsigned short *ucs; 83 unsigned short *ucs;
84 struct font* pf = font_get(current_vp->font); 84 struct font* pf = font_get(current_vp->font);
85 int vp_flags = current_vp->flags;
85 86
86 ucs = bidi_l2v(str, 1); 87 ucs = bidi_l2v(str, 1);
87 88
88 if (VP_IS_RTL(current_vp)) 89 if ((vp_flags & VP_FLAG_ALIGNMENT_MASK) != 0)
89 { 90 {
90 int w; 91 int w;
91 92
92 LCDFN(getstringsize)(str, &w, NULL); 93 LCDFN(getstringsize)(str, &w, NULL);
93 x = current_vp->width - w - x; 94 /* center takes precedence */
95 if (vp_flags & VP_FLAG_CENTER_ALIGN)
96 x = ((current_vp->width - w)/ 2) + x;
97 else
98 x = current_vp->width - w - x;
94 } 99 }
95 100
96 while ((ch = *ucs++) != 0 && x < current_vp->width) 101 while ((ch = *ucs++) != 0 && x < current_vp->width)
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 2c66b5f8b3..463714ff03 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -26,9 +26,13 @@
26#include "cpu.h" 26#include "cpu.h"
27#include "config.h" 27#include "config.h"
28 28
29#define VP_FLAG_IS_RTL 0x01 29#define VP_FLAG_IS_RTL 0x01
30#define VP_FLAG_CENTER_ALIGN 0x02
30 31
31#define VP_IS_RTL(vp) (((vp)->flags & VP_FLAG_IS_RTL) != 0) 32#define VP_FLAG_ALIGNMENT_MASK \
33 (VP_FLAG_IS_RTL|VP_FLAG_CENTER_ALIGN)
34
35#define VP_IS_RTL(vp) (((vp)->flags & VP_FLAG_ALIGNMENT_MASK) == VP_FLAG_IS_RTL)
32 36
33struct viewport { 37struct viewport {
34 int x; 38 int x;