Mercurial > public > ostc4
comparison 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 |
comparison
equal
deleted
inserted
replaced
500:0d2449e9d659 | 501:2ffee0811ad9 |
---|---|
3217 | 3217 |
3218 | 3218 |
3219 if((font == &FontT144) && (*(char*)pText == '.')) | 3219 if((font == &FontT144) && (*(char*)pText == '.')) |
3220 { | 3220 { |
3221 font = (tFont *)&FontT84; | 3221 font = (tFont *)&FontT84; |
3222 tinyState = 2; | |
3222 } | 3223 } |
3223 else | 3224 else |
3224 if((font == &FontT105) && (*(char*)pText == '\16')) // two times to start tiny font | 3225 if((font == &FontT105) && (*(char*)pText == '\16')) // two times to start tiny font |
3225 { | 3226 { |
3226 if(!setToTinyFont) | 3227 if(!setToTinyFont) |
3227 setToTinyFont = 1; | 3228 setToTinyFont = 1; |
3228 else | 3229 else |
3229 font = (tFont *)&FontT54; | 3230 font = (tFont *)&FontT54; |
3230 } | 3231 } |
3231 else | 3232 else |
3232 if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':'))) | 3233 if((font == &FontT105) && cfg->dualFont && ((*(char*)pText == '.') || (*(char*)pText == ':'))) /* Display character after '.' or ':' using smaller font */ |
3233 { | 3234 { |
3234 font = (tFont *)&FontT54; | 3235 font = (tFont *)&FontT54; |
3236 tinyState = 2; | |
3235 } | 3237 } |
3236 | 3238 |
3237 if(*(char*)pText == ' ') | 3239 if(*(char*)pText == ' ') |
3238 { | 3240 { |
3239 Xsum += font->spacesize; | 3241 Xsum += font->spacesize; |
3248 } | 3250 } |
3249 else | 3251 else |
3250 { | 3252 { |
3251 decodeUTF8 = *(char*)pText; | 3253 decodeUTF8 = *(char*)pText; |
3252 } | 3254 } |
3253 for(i=0;i<font->length;i++) | 3255 for(i=0;i<font->length;i++) /* lookup character and add width */ |
3254 { | 3256 { |
3255 if(font->chars[i].code == decodeUTF8) | 3257 if(font->chars[i].code == decodeUTF8) |
3256 { | 3258 { |
3257 Xsum += font->chars[i].image->width; | 3259 Xsum += font->chars[i].image->width; |
3258 break; | 3260 break; |