Mercurial > public > ostc4
comparison Discovery/Src/gfx_engine.c @ 482:230aed360da0
Merged in Ideenmodellierer/ostc4/Improve_Button_Sleep (pull request #45)
Improve Button Sleep
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Tue, 19 May 2020 07:27:18 +0000 |
parents | 89f6857276f8 |
children | 7a17bfc932b6 |
comparison
equal
deleted
inserted
replaced
472:8a375f0544d9 | 482:230aed360da0 |
---|---|
3083 uint32_t Xsum; | 3083 uint32_t Xsum; |
3084 uint32_t i, j; | 3084 uint32_t i, j; |
3085 uint8_t gfx_selected_language; | 3085 uint8_t gfx_selected_language; |
3086 uint32_t pText; | 3086 uint32_t pText; |
3087 uint16_t decodeUTF8; | 3087 uint16_t decodeUTF8; |
3088 uint8_t tinyState = 0; /* used to identify the usage of tiny font */ | |
3089 tFont* ptargetFont; | |
3088 | 3090 |
3089 #ifndef BOOTLOADER_STANDALONE | 3091 #ifndef BOOTLOADER_STANDALONE |
3090 SSettings *pSettings; | 3092 SSettings *pSettings; |
3091 pSettings = settingsGetPointer(); | 3093 pSettings = settingsGetPointer(); |
3092 gfx_selected_language = pSettings->selected_language; | 3094 gfx_selected_language = pSettings->selected_language; |
3100 pText = (uint32_t)&cText[0]; | 3102 pText = (uint32_t)&cText[0]; |
3101 Xsum = 0; | 3103 Xsum = 0; |
3102 j = 0; | 3104 j = 0; |
3103 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size | 3105 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size |
3104 { | 3106 { |
3107 if(*(char*)pText == '\016') /* request font change */ | |
3108 { | |
3109 tinyState++; | |
3110 } | |
3111 if(*(char*)pText == '\017') /* request font reset */ | |
3112 { | |
3113 tinyState = 0; | |
3114 } | |
3115 if(tinyState > 1) | |
3116 { | |
3117 ptargetFont = (tFont *)cfg->TinyFont; | |
3118 } | |
3119 else | |
3120 { | |
3121 ptargetFont = (tFont *)cfg->font; | |
3122 } | |
3105 if((*(char*)pText) & 0x80) /* Identify a UNICODE character other than standard ASCII using the highest bit */ | 3123 if((*(char*)pText) & 0x80) /* Identify a UNICODE character other than standard ASCII using the highest bit */ |
3106 { | 3124 { |
3107 decodeUTF8 = ((*(char*)pText) & 0x1F) << 6; /* use 5bits of first byte for upper part of unicode */ | 3125 decodeUTF8 = ((*(char*)pText) & 0x1F) << 6; /* use 5bits of first byte for upper part of unicode */ |
3108 pText++; | 3126 pText++; |
3109 decodeUTF8 |= (*(char*)pText) & 0x3F; /* add lower 6bits as second part of the unicode */ | 3127 decodeUTF8 |= (*(char*)pText) & 0x3F; /* add lower 6bits as second part of the unicode */ |
3111 else | 3129 else |
3112 { | 3130 { |
3113 decodeUTF8 = *(char*)pText; /* place ASCII char */ | 3131 decodeUTF8 = *(char*)pText; /* place ASCII char */ |
3114 } | 3132 } |
3115 | 3133 |
3116 for(i=0;i<((tFont *)cfg->font)->length;i++) | 3134 for(i=0;i<ptargetFont->length;i++) |
3117 { | 3135 { |
3118 if(((tFont *)cfg->font)->chars[i].code == decodeUTF8) | 3136 if(ptargetFont->chars[i].code == decodeUTF8) |
3119 { | 3137 { |
3120 Xsum += ((tFont *)cfg->font)->chars[i].image->width; | 3138 Xsum += ptargetFont->chars[i].image->width; |
3121 break; | 3139 break; |
3122 } | 3140 } |
3123 } | 3141 } |
3124 pText++; | 3142 pText++; |
3125 j++; | 3143 j++; |
3126 if(((tFont *)cfg->font == &FontT144) && (*(char*)pText != 0)) | 3144 if((ptargetFont == &FontT144) && (*(char*)pText != 0)) |
3127 Xsum += 3; | 3145 Xsum += 3; |
3128 else | 3146 else |
3129 if(((tFont *)cfg->font == &FontT105) && (*(char*)pText != 0)) | 3147 if((ptargetFont == &FontT105) && (*(char*)pText != 0)) |
3130 Xsum += 2; | 3148 Xsum += 2; |
3131 } | 3149 } |
3132 pText -= j; | 3150 pText -= j; |
3133 | 3151 |
3134 if(cfg->doubleSize) | 3152 if(cfg->doubleSize) |