changeset 565:7b56d4eda695

Bugfix center / right alignment if dualfont is used: The implementation of the dualfont effects on string screen sizes was different and the center function did not consider this feature at all. Changed implementation for both functions to behalf the same way.
author Ideenmodellierer
date Sun, 15 Nov 2020 20:12:19 +0100
parents 5e0a75e2f00b
children 7761dd028386
files Discovery/Src/gfx_engine.c
diffstat 1 files changed, 17 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/gfx_engine.c	Sun Nov 15 20:09:31 2020 +0100
+++ b/Discovery/Src/gfx_engine.c	Sun Nov 15 20:12:19 2020 +0100
@@ -3102,6 +3102,7 @@
 	pText = (uint32_t)&cText[0];
 	Xsum = 0;
 	j = 0;
+	ptargetFont = (tFont *)cfg->font;
 	while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
 	{
 		if(*(char*)pText == '\016')	/* request font change */
@@ -3112,6 +3113,12 @@
 		{
 			tinyState = 0;
 		}
+
+		if((ptargetFont == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
+		{
+			tinyState++;
+		}
+
 		if(tinyState > 1)
 		{
 			ptargetFont = (tFont *)cfg->TinyFont;
@@ -3206,6 +3213,16 @@
 		{
 			tinyState = 0;
 		}
+
+		if((font == &FontT144) && (*(char*)pText == '.'))
+		{
+			tinyState++;
+		}
+		if((font == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
+		{
+			tinyState++;
+		}
+
 		if(tinyState > 1)
 		{
 			font = (tFont *)cfg->TinyFont;
@@ -3215,27 +3232,6 @@
 			font = (tFont *)cfg->font;
 		}
 
-
-		if((font == &FontT144) && (*(char*)pText == '.'))
-		{
-			font = (tFont *)&FontT84;
-			tinyState = 2;
-		}
-		else
-		if((font == &FontT105) && (*(char*)pText == '\16')) // two times to start tiny font
-		{
-			if(!setToTinyFont)
-				setToTinyFont = 1;
-			else
-				font = (tFont *)&FontT54;
-		}
-		else
-		if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':')))		/* Display character after '.' or ':' using smaller font */
-		{
-			font = (tFont *)&FontT54;
-			tinyState = 2;
-		}
-
 		if(*(char*)pText == ' ')
 		{
 			Xsum += font->spacesize;