diff Discovery/Src/gfx_engine.c @ 501:2ffee0811ad9

Bugfix right alignment of dualfont strings Dualfonts support the change of font size after a '.' or ':'. The function realizing this did not consider the font change in the calculation of the string screen size causing a misalignment. An existing indicator for the fontchange is used to avoid this problem now.
author Ideenmodellierer
date Mon, 24 Aug 2020 19:39:28 +0200
parents 7a17bfc932b6
children 56824129dd56
line wrap: on
line diff
--- a/Discovery/Src/gfx_engine.c	Mon Aug 24 19:36:18 2020 +0200
+++ b/Discovery/Src/gfx_engine.c	Mon Aug 24 19:39:28 2020 +0200
@@ -3219,6 +3219,7 @@
 		if((font == &FontT144) && (*(char*)pText == '.'))
 		{
 			font = (tFont *)&FontT84;
+			tinyState = 2;
 		}
 		else
 		if((font == &FontT105) && (*(char*)pText == '\16')) // two times to start tiny font
@@ -3229,9 +3230,10 @@
 				font = (tFont *)&FontT54;
 		}
 		else
-		if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':')))
+		if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':')))		/* Display character after '.' or ':' using smaller font */
 		{
 			font = (tFont *)&FontT54;
+			tinyState = 2;
 		}
 
 		if(*(char*)pText == ' ')
@@ -3250,7 +3252,7 @@
 			{
 				decodeUTF8 = *(char*)pText;
 			}
-			for(i=0;i<font->length;i++)
+			for(i=0;i<font->length;i++)						/* lookup character and add width */
 			{
 				if(font->chars[i].code == decodeUTF8)
 				{