changeset 485:7a17bfc932b6 FixLayout_Header_LogView

Bugfix right alignment of string: Size calculation did not consider "tiny" displayed characters as used for example for units => added code to identify small font and adapt calculation
author ideenmodellierer
date Tue, 26 May 2020 21:13:00 +0200
parents eea282e733e8
children 3db9eba89e3c
files Discovery/Src/gfx_engine.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/gfx_engine.c	Tue May 26 21:12:46 2020 +0200
+++ b/Discovery/Src/gfx_engine.c	Tue May 26 21:13:00 2020 +0200
@@ -3175,6 +3175,7 @@
 	uint32_t pText;
 	uint8_t setToTinyFont = 0;
 	uint16_t decodeUTF8;
+	uint8_t tinyState = 0;		/* used to identify the usage of tiny font */
 
 #ifndef BOOTLOADER_STANDALONE
 	SSettings *pSettings;
@@ -3197,6 +3198,24 @@
 
 	while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
 	{
+		if(*(char*)pText == '\016')	/* request font change */
+		{
+			tinyState++;
+		}
+		if(*(char*)pText == '\017')	/* request font reset */
+		{
+			tinyState = 0;
+		}
+		if(tinyState > 1)
+		{
+			font = (tFont *)cfg->TinyFont;
+		}
+		else
+		{
+			font = (tFont *)cfg->font;
+		}
+
+
 		if((font == &FontT144) && (*(char*)pText == '.'))
 		{
 			font = (tFont *)&FontT84;