Mercurial > public > ostc4
comparison Discovery/Src/gfx_engine.c @ 567:1c95f811967c
-Add 12HR Time Support
-Add firmware image only font extensions
-Show english units when required in log's graphs
-Show decompression info with Font84 if 10 characters long
-Remove usage of ' symbol to denote minutes and instead use min abbreviation
-Show english units when required on the simulation configuration screen
-Remove usage of ' symbol to denote feet in in non-metric mode and use ft abbrevation
author | izzni |
---|---|
date | Tue, 24 Nov 2020 13:22:23 -0600 |
parents | 7b56d4eda695 |
children | 3860b8fa4b29 |
comparison
equal
deleted
inserted
replaced
566:7761dd028386 | 567:1c95f811967c |
---|---|
2654 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated | 2654 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated |
2655 */ | 2655 */ |
2656 | 2656 |
2657 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font) | 2657 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font) |
2658 { | 2658 { |
2659 Font = GFX_Check_Extra_Font(character, Font); | |
2659 if(cfg->doubleSize) | 2660 if(cfg->doubleSize) |
2660 { | 2661 { |
2661 return GFX_write_char_doubleSize(hgfx, cfg, character, Font); | 2662 return GFX_write_char_doubleSize(hgfx, cfg, character, Font); |
2662 } | 2663 } |
2663 | 2664 |
3136 else | 3137 else |
3137 { | 3138 { |
3138 decodeUTF8 = *(char*)pText; /* place ASCII char */ | 3139 decodeUTF8 = *(char*)pText; /* place ASCII char */ |
3139 } | 3140 } |
3140 | 3141 |
3141 for(i=0;i<ptargetFont->length;i++) | 3142 Xsum += GFX_Character_Width(decodeUTF8, ptargetFont); |
3142 { | 3143 |
3143 if(ptargetFont->chars[i].code == decodeUTF8) | |
3144 { | |
3145 Xsum += ptargetFont->chars[i].image->width; | |
3146 break; | |
3147 } | |
3148 } | |
3149 pText++; | 3144 pText++; |
3150 j++; | 3145 j++; |
3151 if((ptargetFont == &FontT144) && (*(char*)pText != 0)) | 3146 if((ptargetFont == &FontT144) && (*(char*)pText != 0)) |
3152 Xsum += 3; | 3147 Xsum += 3; |
3153 else | 3148 else |
3246 } | 3241 } |
3247 else | 3242 else |
3248 { | 3243 { |
3249 decodeUTF8 = *(char*)pText; | 3244 decodeUTF8 = *(char*)pText; |
3250 } | 3245 } |
3251 for(i=0;i<font->length;i++) /* lookup character and add width */ | 3246 Xsum += GFX_Character_Width(decodeUTF8, font); /* lookup character and add width */ |
3252 { | |
3253 if(font->chars[i].code == decodeUTF8) | |
3254 { | |
3255 Xsum += font->chars[i].image->width; | |
3256 break; | |
3257 } | |
3258 } | |
3259 } | 3247 } |
3260 pText++; | 3248 pText++; |
3261 j++; | 3249 j++; |
3262 if((font == &FontT144) && (*(char*)pText != 0)) | 3250 if((font == &FontT144) && (*(char*)pText != 0)) |
3263 Xsum += 3; | 3251 Xsum += 3; |
3871 *(__IO uint8_t*)(pDestination++) = 0; | 3859 *(__IO uint8_t*)(pDestination++) = 0; |
3872 } | 3860 } |
3873 } | 3861 } |
3874 */ | 3862 */ |
3875 } | 3863 } |
3864 | |
3865 tFont* GFX_Check_Extra_Font(uint8_t character, tFont *Font) | |
3866 { | |
3867 uint32_t i; | |
3868 uint32_t found; | |
3869 | |
3870 found = 0; | |
3871 for(i=0;i<Font->length;i++) | |
3872 { | |
3873 if(Font->chars[i].code == character) | |
3874 { | |
3875 found = 1; | |
3876 break; | |
3877 } | |
3878 } | |
3879 if (!found && Font == &FontT54) | |
3880 { | |
3881 Font = &FontT54Extra; | |
3882 } | |
3883 else if (!found && (Font == &FontT84 || Font == &FontT84Spaced)) | |
3884 { | |
3885 Font = &FontT84Extra; | |
3886 } | |
3887 else if (!found && Font == &FontT105) | |
3888 { | |
3889 Font = &FontT105Extra; | |
3890 } | |
3891 | |
3892 return Font; | |
3893 } | |
3894 | |
3895 uint32_t GFX_Character_Width(uint8_t character, tFont *Font) | |
3896 { | |
3897 uint32_t i; | |
3898 uint32_t found; | |
3899 | |
3900 for(i=0;i<Font->length;i++) | |
3901 { | |
3902 if(Font->chars[i].code == character) | |
3903 { | |
3904 return Font->chars[i].image->width; | |
3905 } | |
3906 } | |
3907 | |
3908 found = 0; | |
3909 if (Font == &FontT54) | |
3910 { | |
3911 found = 1; | |
3912 Font = &FontT54Extra; | |
3913 } | |
3914 else if (Font == &FontT84 || Font == &FontT84Spaced) | |
3915 { | |
3916 found = 1; | |
3917 Font = &FontT84Extra; | |
3918 } | |
3919 else if (Font == &FontT105) | |
3920 { | |
3921 found = 1; | |
3922 Font = &FontT105Extra; | |
3923 } | |
3924 | |
3925 if (found) | |
3926 { | |
3927 for(i=0;i<Font->length;i++) | |
3928 { | |
3929 if(Font->chars[i].code == character) | |
3930 { | |
3931 return Font->chars[i].image->width; | |
3932 } | |
3933 } | |
3934 } | |
3935 | |
3936 return 0; | |
3937 } |