# HG changeset patch
# User ideenmodellierer
# Date 1590520380 -7200
# Node ID 7a17bfc932b6cdc10be09e50ccf318ac24d1e715
# Parent  eea282e733e8d023bf59c712bbb2cd4fb5bdb324
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

diff -r eea282e733e8 -r 7a17bfc932b6 Discovery/Src/gfx_engine.c
--- 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;