comparison Discovery/Src/gfx_engine.c @ 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 0ad0b26ec56b
children 1c95f811967c
comparison
equal deleted inserted replaced
564:5e0a75e2f00b 565:7b56d4eda695
3100 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language); 3100 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language);
3101 3101
3102 pText = (uint32_t)&cText[0]; 3102 pText = (uint32_t)&cText[0];
3103 Xsum = 0; 3103 Xsum = 0;
3104 j = 0; 3104 j = 0;
3105 ptargetFont = (tFont *)cfg->font;
3105 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size 3106 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
3106 { 3107 {
3107 if(*(char*)pText == '\016') /* request font change */ 3108 if(*(char*)pText == '\016') /* request font change */
3108 { 3109 {
3109 tinyState++; 3110 tinyState++;
3110 } 3111 }
3111 if(*(char*)pText == '\017') /* request font reset */ 3112 if(*(char*)pText == '\017') /* request font reset */
3112 { 3113 {
3113 tinyState = 0; 3114 tinyState = 0;
3114 } 3115 }
3116
3117 if((ptargetFont == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
3118 {
3119 tinyState++;
3120 }
3121
3115 if(tinyState > 1) 3122 if(tinyState > 1)
3116 { 3123 {
3117 ptargetFont = (tFont *)cfg->TinyFont; 3124 ptargetFont = (tFont *)cfg->TinyFont;
3118 } 3125 }
3119 else 3126 else
3204 } 3211 }
3205 if(*(char*)pText == '\017') /* request font reset */ 3212 if(*(char*)pText == '\017') /* request font reset */
3206 { 3213 {
3207 tinyState = 0; 3214 tinyState = 0;
3208 } 3215 }
3216
3217 if((font == &FontT144) && (*(char*)pText == '.'))
3218 {
3219 tinyState++;
3220 }
3221 if((font == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
3222 {
3223 tinyState++;
3224 }
3225
3209 if(tinyState > 1) 3226 if(tinyState > 1)
3210 { 3227 {
3211 font = (tFont *)cfg->TinyFont; 3228 font = (tFont *)cfg->TinyFont;
3212 } 3229 }
3213 else 3230 else
3214 { 3231 {
3215 font = (tFont *)cfg->font; 3232 font = (tFont *)cfg->font;
3216 }
3217
3218
3219 if((font == &FontT144) && (*(char*)pText == '.'))
3220 {
3221 font = (tFont *)&FontT84;
3222 tinyState = 2;
3223 }
3224 else
3225 if((font == &FontT105) && (*(char*)pText == '\16')) // two times to start tiny font
3226 {
3227 if(!setToTinyFont)
3228 setToTinyFont = 1;
3229 else
3230 font = (tFont *)&FontT54;
3231 }
3232 else
3233 if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':'))) /* Display character after '.' or ':' using smaller font */
3234 {
3235 font = (tFont *)&FontT54;
3236 tinyState = 2;
3237 } 3233 }
3238 3234
3239 if(*(char*)pText == ' ') 3235 if(*(char*)pText == ' ')
3240 { 3236 {
3241 Xsum += font->spacesize; 3237 Xsum += font->spacesize;