Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 481:89f6857276f8 Improve_Button_Sleep
Bugfix calculation of string center position:
Strings shown on the right side at surface mode use special characters ('\016' and '\017') to switch font size. Headline strings like "Desaturation" could also be set to the target font directly, because they do not contain mixed font sizes, but nethertheless they are using the special characters.
The function calculating the offset needed to display the strinter with center alignment did not consider the small font size => misalignment during string display. To avoid this an evaluation of the special characters has been added to the helper function.
author | ideenmodellierer |
---|---|
date | Mon, 18 May 2020 21:51:08 +0200 |
parents | 5e6a612d03b5 |
children | fa8b09544b3d |
comparison
equal
deleted
inserted
replaced
480:3fe9cc747c5c | 481:89f6857276f8 |
---|---|
787 | 787 |
788 if(!DataEX_was_power_on() && !errorsInSettings) | 788 if(!DataEX_was_power_on() && !errorsInSettings) |
789 { | 789 { |
790 text[0] = '\001'; | 790 text[0] = '\001'; |
791 text[1] = '\004'; | 791 text[1] = '\004'; |
792 text[2] = TXT_2BYTE; | 792 text[2] = '\016'; |
793 text[3] = TXT2BYTE_Sunday; | 793 text[3] = '\016'; |
794 text[4] = 0; | 794 text[4] = TXT_2BYTE; |
795 text[5] = TXT2BYTE_Sunday; | |
796 text[6] = 0; | |
795 if(Sdate.WeekDay != RTC_WEEKDAY_SUNDAY) | 797 if(Sdate.WeekDay != RTC_WEEKDAY_SUNDAY) |
796 text[3] += Sdate.WeekDay; | 798 text[5] += Sdate.WeekDay; |
797 | 799 |
798 if(!(Stime.Seconds % 2) && (dateNotSet == 1)) | 800 if(!(Stime.Seconds % 2) && (dateNotSet == 1)) |
799 text[1] = '\021'; | 801 text[1] = '\021'; |
800 | 802 |
801 GFX_write_string(&FontT24,&t7surfaceR,text,4); | 803 GFX_write_string(&FontT48,&t7surfaceR,text,4); |
802 } | 804 } |
803 | 805 |
804 /* DEBUG uTick Pressure and Compass */ | 806 /* DEBUG uTick Pressure and Compass */ |
805 /* | 807 /* |
806 snprintf(text,255,"\001%u",stateRealGetPointer()->pressure_uTick_new - stateRealGetPointer()->pressure_uTick_old); | 808 snprintf(text,255,"\001%u",stateRealGetPointer()->pressure_uTick_new - stateRealGetPointer()->pressure_uTick_old); |