Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LANG_UTF8_Text.c Source File

LANG_UTF8_Text.c

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH                         *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2018  SEGGER Microcontroller GmbH                *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.48 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software  has been licensed to  Cypress Semiconductor Corporation,
00019 whose registered  office is situated  at 198 Champion Ct. San Jose, CA 
00020 95134 USA  solely for the  purposes of creating  libraries for Cypress
00021 PSoC3 and  PSoC5 processor-based devices,  sublicensed and distributed
00022 under  the  terms  and  conditions  of  the  Cypress  End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 Licensor:                 SEGGER Microcontroller Systems LLC
00030 Licensed to:              Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
00031 Licensed SEGGER software: emWin
00032 License number:           GUI-00319
00033 License model:            Services and License Agreement, signed June 10th, 2009
00034 Licensed platform:        Any Cypress platform (Initial targets are: PSoC3, PSoC5)
00035 ----------------------------------------------------------------------
00036 Support and Update Agreement (SUA)
00037 SUA period:               2009-06-12 - 2022-07-27
00038 Contact to extend SUA:    sales@segger.com
00039 ----------------------------------------------------------------------
00040 File        : LANG_UTF8_Text.c
00041 Purpose     : Sample application which shows how text resource files
00042               can be used to display different languages using UTF-8.
00043 Requirements: WindowManager - ( )
00044               MemoryDevices - ( )
00045               AntiAliasing  - ( )
00046               VNC-Server    - ( )
00047               PNG-Library   - ( )
00048               TrueTypeFonts - ( )
00049 ----------------------------------------------------------------------
00050 */
00051 
00052 #include "GUI.h"
00053 
00054 #define SPACE_TO_TOP  40
00055 #define CRLF          "\r\n"      // Carriage Return = '\r' - Line Feed = '\n'
00056 
00057 /*********************************************************************
00058 *
00059 *       Defines
00060 *
00061 **********************************************************************
00062 */
00063 //
00064 // Recommended memory to run the sample with adequate performance
00065 //
00066 #define RECOMMENDED_MEMORY (1024L * 10)
00067 
00068 /*********************************************************************
00069 *
00070 *       _GUI_FontJapanese_headline16
00071 *
00072 **********************************************************************
00073 */
00074 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_headline16_4EBA[ 28] = { // Code 4EBA
00075   _______X,XX______,
00076   _______X,X_______,
00077   _______X,X_______,
00078   _______X,X_______,
00079   ______XX,XX______,
00080   ______XX,XX______,
00081   ______XX,XX______,
00082   _____XX_,_XX_____,
00083   _____XX_,_XX_____,
00084   ____XX__,__XX____,
00085   ____XX__,__XX____,
00086   ___XX___,___XX___,
00087   __XX____,____XX__,
00088   XXX_____,_____XXX};
00089 
00090 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_headline16_65E5[ 28] = { // Code 65E5
00091   XX______,XX______,
00092   XXXXXXXX,XXX_____,
00093   XX______,XX______,
00094   XX______,XX______,
00095   XX______,XX______,
00096   XX______,XX______,
00097   XXXXXXXX,XX______,
00098   XX______,XX______,
00099   XX______,XX______,
00100   XX______,XX______,
00101   XX______,XX______,
00102   XXXXXXXX,XX______,
00103   XX______,XX______,
00104   XX______,________};
00105 
00106 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_headline16_672C[ 30] = { // Code 672C
00107   _______X,XX______,
00108   _______X,X_______,
00109   _______X,X____XX_,
00110   XXXXXXXX,XXXXXXXX,
00111   ______XX,XX______,
00112   _____XXX,XXX_____,
00113   _____XXX,XXX_____,
00114   ____XX_X,X_XX____,
00115   ___XX__X,X__XX___,
00116   __XX___X,XXX_XX__,
00117   _XX_XXXX,XXXX_XX_,
00118   XX_____X,X_____XX,
00119   _______X,X_______,
00120   _______X,X_______,
00121   _______X,X_______};
00122 
00123 static GUI_CONST_STORAGE GUI_CHARINFO_EXT _GUI_FontJapanese_headline16_CharInfo[3] = {
00124    {  16,  14,   0,   1,  17, _acGUI_FontJapanese_headline16_4EBA } // Code 4EBA
00125   ,{  11,  14,   3,   1,  17, _acGUI_FontJapanese_headline16_65E5 } // Code 65E5
00126   ,{  16,  15,   0,   0,  17, _acGUI_FontJapanese_headline16_672C } // Code 672C
00127 };
00128 
00129 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_headline16_Prop3 = {
00130    0x672C                                      // First character
00131   ,0x672C                                      // Last character 
00132   ,&_GUI_FontJapanese_headline16_CharInfo[  2] // Address of first character
00133   ,(GUI_CONST_STORAGE GUI_FONT_PROP_EXT *)0    // Pointer to next GUI_FONT_PROP_EXT
00134 };
00135 
00136 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_headline16_Prop2 = {
00137    0x65E5                                      // First character
00138   ,0x65E5                                      // Last character 
00139   ,&_GUI_FontJapanese_headline16_CharInfo[  1] // Address of first character
00140   ,&_GUI_FontJapanese_headline16_Prop3         // Pointer to next GUI_FONT_PROP_EXT
00141 };
00142 
00143 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_headline16_Prop1 = {
00144    0x4EBA                                      // First character
00145   ,0x4EBA                                      // Last character 
00146   ,&_GUI_FontJapanese_headline16_CharInfo[  0] // Address of first character
00147   ,&_GUI_FontJapanese_headline16_Prop2         // Pointer to next GUI_FONT_PROP_EXT
00148 };
00149 
00150 static GUI_CONST_STORAGE GUI_FONT _GUI_FontJapanese_headline16 = {
00151    GUI_FONTTYPE_PROP_EXT // Type of font   
00152   ,16                    // Height of font 
00153   ,16                    // Space of font y
00154   ,1                     // Magnification x
00155   ,1                     // Magnification y
00156   ,{&_GUI_FontJapanese_headline16_Prop1}
00157   ,14                    // Baseline
00158   ,8                     // Height of lowercase characters
00159   ,13                    // Height of capital characters
00160 };
00161 
00162 /*********************************************************************
00163 *
00164 *       _GUI_FontJapanese_text16
00165 *
00166 **********************************************************************
00167 */
00168 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_0057[ 13] = { // Code 0057, LATIN CAPITAL LETTER W
00169   XX_X_XX_,
00170   X__X__X_,
00171   X__X__X_,
00172   X__X__X_,
00173   X_X_X_X_,
00174   X_X_X_X_,
00175   X_X_X_X_,
00176   X_X_X_X_,
00177   _X___X__,
00178   _X___X__,
00179   _X___X__,
00180   _X___X__,
00181   _X___X__};
00182 
00183 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_0065[  8] = { // Code 0065, LATIN SMALL LETTER E
00184   __XX____,
00185   _X__X___,
00186   X____X__,
00187   XXXXXX__,
00188   X_______,
00189   X_______,
00190   _X___X__,
00191   __XXX___};
00192 
00193 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_0069[ 12] = { // Code 0069, LATIN SMALL LETTER I
00194   _X______,
00195   _X______,
00196   ________,
00197   ________,
00198   XX______,
00199   _X______,
00200   _X______,
00201   _X______,
00202   _X______,
00203   _X______,
00204   _X______,
00205   XXX_____};
00206 
00207 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_006D[  8] = { // Code 006D, LATIN SMALL LETTER M
00208   X_X_XX__,
00209   XX_X__X_,
00210   X__X__X_,
00211   X__X__X_,
00212   X__X__X_,
00213   X__X__X_,
00214   X__X__X_,
00215   X_XX_XX_};
00216 
00217 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_006E[  8] = { // Code 006E, LATIN SMALL LETTER N
00218   XX_XX___,
00219   _XX__X__,
00220   _X___X__,
00221   _X___X__,
00222   _X___X__,
00223   _X___X__,
00224   _X___X__,
00225   XXX_XXX_};
00226 
00227 //
00228 // Start of unicode area <Hiragana>
00229 //
00230 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_3055[ 28] = { // Code 3055, HIRAGANA LETTER SA
00231   _____XX_,________,
00232   ______X_,________,
00233   ______X_,________,
00234   X______X,_XX_____,
00235   _XXXXXXX,X_______,
00236   _______X,________,
00237   ________,X_______,
00238   __XXXXX_,X_______,
00239   _X_____X,XX______,
00240   X_______,_X______,
00241   X_______,________,
00242   X_______,________,
00243   _XX_____,________,
00244   ___XXXXX,________};
00245 
00246 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_3056[ 28] = { // Code 3056, HIRAGANA LETTER ZA
00247   _____XX_,___X____,
00248   ______X_,_X__X___,
00249   ______X_,__X_____,
00250   X______X,_X______,
00251   _XXXXXXX,X_______,
00252   _______X,________,
00253   ________,X_______,
00254   __XXXXX_,X_______,
00255   _X_____X,XX______,
00256   X_______,_X______,
00257   X_______,________,
00258   X_______,________,
00259   _XX_____,________,
00260   ___XXXXX,________};
00261 
00262 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_306A[ 28] = { // Code 306A, HIRAGANA LETTER NA
00263   __XX____,________,
00264   ___X____,________,
00265   X__X_XX_,_XX_____,
00266   _XXXXX__,___X____,
00267   __X_____,____X___,
00268   __X_____,_X_XX___,
00269   __X_____,X_______,
00270   _X______,X_______,
00271   _X______,X_______,
00272   XX______,X_______,
00273   X___XXXX,XX______,
00274   ___X____,X_XX____,
00275   ___X____,X__XX___,
00276   ____XXXX,________};
00277 
00278 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_307E[ 28] = { // Code 307E, HIRAGANA LETTER MA
00279   _____XX_,________,
00280   ______X_,________,
00281   X_____XX,XXXX____,
00282   _XXXXXX_,________,
00283   ______X_,________,
00284   ______X_,________,
00285   _X____XX,XXX_____,
00286   __XXXXX_,________,
00287   ______X_,________,
00288   ______X_,________,
00289   __XXXXXX,________,
00290   _X____X_,XX______,
00291   _X____X_,__XX____,
00292   __XXXX__,___X____};
00293 
00294 //
00295 // Start of unicode area <Katakana>
00296 //
00297 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_30B5[ 26] = { // Code 30B5, KATAKANA LETTER SA
00298   ________,XX______,
00299   ___XX___,_X______,
00300   ____X___,_X__X___,
00301   X___XXXX,XXXXXX__,
00302   _XXXX___,_X______,
00303   ____X___,_X______,
00304   ____X___,_X______,
00305   ____X___,_X______,
00306   ________,_X______,
00307   ________,X_______,
00308   ________,X_______,
00309   _______X,________,
00310   _____XX_,________};
00311 
00312 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_30C8[ 13] = { // Code 30C8, KATAKANA LETTER TO
00313   XX______,
00314   _XX_____,
00315   _X______,
00316   _X______,
00317   _X______,
00318   _XXX____,
00319   _X__XX__,
00320   _X___XX_,
00321   _X____X_,
00322   _X______,
00323   _X______,
00324   _X______,
00325   _X______};
00326 
00327 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_30DD[ 28] = { // Code 30DD, KATAKANA LETTER PO
00328   ________,___XX___,
00329   _____XX_,__X__X__,
00330   ______XX,__X__X__,
00331   ______X_,___XX___,
00332   XXXXXXXX,XXXX____,
00333   _X____X_,________,
00334   ______X_,________,
00335   __X___X_,_X______,
00336   __X___X_,__X_____,
00337   _X____X_,___X____,
00338   XX_X__X_,___XX___,
00339   X___X_X_,____X___,
00340   _____XX_,________,
00341   _____X__,________};
00342 
00343 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_30FC[  6] = { // Code 30FC, KATAKANA-HIRAGANA PROLONGED SOUND MARK
00344   ________,___X____,
00345   XX____XX,XXXXX___,
00346   _XXXXX__,________};
00347 
00348 //
00349 // Start of unicode area <CJK Unified Ideographs>
00350 //
00351 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_8A00[ 30] = { // Code 8A00
00352   ________,X_______,
00353   __XXXXXX,XX______,
00354   ________,___X____,
00355   XXXXXXXX,XXXXX___,
00356   ________,________,
00357   __XXXXXX,XXX_____,
00358   ________,________,
00359   __XXXXXX,XXX_____,
00360   ________,________,
00361   ________,__X_____,
00362   __XXXXXX,XXXX____,
00363   __X_____,__X_____,
00364   __X_____,__X_____,
00365   __XXXXXX,XXX_____,
00366   __X_____,__X_____};
00367 
00368 static GUI_CONST_STORAGE unsigned char _acGUI_FontJapanese_text16_8A9E[ 30] = { // Code 8A9E
00369   ___X____,____X___,
00370   _XXXX_XX,XXXXXX__,
00371   ________,_X______,
00372   ____X___,_X__X___,
00373   XXXXX_XX,XXXXXX__,
00374   ________,X___X___,
00375   _XXXX___,X___X_X_,
00376   ______XX,XXXXXXX_,
00377   _XXXX___,________,
00378   _______X,XXXXX___,
00379   _XXXX__X,____X___,
00380   _X__X__X,____X___,
00381   _X__X__X,____X___,
00382   _XXXX__X,XXXXX___,
00383   _X__X__X,____X___};
00384 
00385 static GUI_CONST_STORAGE GUI_CHARINFO_EXT _GUI_FontJapanese_text16_CharInfo[15] = {
00386    {   7,  13,   0,   1,   8, _acGUI_FontJapanese_text16_0057 } // Code 0057, LATIN CAPITAL LETTER W
00387   ,{   6,   8,   1,   6,   8, _acGUI_FontJapanese_text16_0065 } // Code 0065, LATIN SMALL LETTER E
00388   ,{   3,  12,   2,   2,   8, _acGUI_FontJapanese_text16_0069 } // Code 0069, LATIN SMALL LETTER I
00389   ,{   7,   8,   0,   6,   8, _acGUI_FontJapanese_text16_006D } // Code 006D, LATIN SMALL LETTER M
00390   ,{   7,   8,   0,   6,   8, _acGUI_FontJapanese_text16_006E } // Code 006E, LATIN SMALL LETTER N
00391   ,{  11,  14,   2,   0,  16, _acGUI_FontJapanese_text16_3055 } // Code 3055, HIRAGANA LETTER SA
00392   ,{  13,  14,   2,   0,  16, _acGUI_FontJapanese_text16_3056 } // Code 3056, HIRAGANA LETTER ZA
00393   ,{  13,  14,   1,   0,  16, _acGUI_FontJapanese_text16_306A } // Code 306A, HIRAGANA LETTER NA
00394   ,{  12,  14,   1,   1,  16, _acGUI_FontJapanese_text16_307E } // Code 307E, HIRAGANA LETTER MA
00395   ,{  14,  13,   0,   1,  16, _acGUI_FontJapanese_text16_30B5 } // Code 30B5, KATAKANA LETTER SA
00396   ,{   7,  13,   5,   1,  16, _acGUI_FontJapanese_text16_30C8 } // Code 30C8, KATAKANA LETTER TO
00397   ,{  14,  14,   1,   0,  16, _acGUI_FontJapanese_text16_30DD } // Code 30DD, KATAKANA LETTER PO
00398   ,{  13,   3,   1,   6,  16, _acGUI_FontJapanese_text16_30FC } // Code 30FC, KATAKANA-HIRAGANA PROLONGED SOUND MARK
00399   ,{  13,  15,   1,   0,  16, _acGUI_FontJapanese_text16_8A00 } // Code 8A00
00400   ,{  15,  15,   0,   0,  16, _acGUI_FontJapanese_text16_8A9E } // Code 8A9E
00401 };
00402 
00403 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop13 = {
00404    0x8A9E                                   // First character
00405   ,0x8A9E                                   // Last character 
00406   ,&_GUI_FontJapanese_text16_CharInfo[ 14]  // Address of first character
00407   ,(GUI_CONST_STORAGE GUI_FONT_PROP_EXT *)0 // Pointer to next GUI_FONT_PROP_EXT
00408 };
00409 
00410 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop12 = {
00411    0x8A00                                  // First character
00412   ,0x8A00                                  // Last character 
00413   ,&_GUI_FontJapanese_text16_CharInfo[ 13] // Address of first character
00414   ,&_GUI_FontJapanese_text16_Prop13        // Pointer to next GUI_FONT_PROP_EXT
00415 };
00416 
00417 GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop11 = {
00418    0x30FC                                  // First character
00419   ,0x30FC                                  // Last character 
00420   ,&_GUI_FontJapanese_text16_CharInfo[ 12] // Address of first character
00421   ,&_GUI_FontJapanese_text16_Prop12        // Pointer to next GUI_FONT_PROP_EXT
00422 };
00423 
00424 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop10 = {
00425    0x30DD                                  // First character
00426   ,0x30DD                                  // Last character 
00427   ,&_GUI_FontJapanese_text16_CharInfo[ 11] // Address of first character
00428   ,&_GUI_FontJapanese_text16_Prop11        // Pointer to next GUI_FONT_PROP_EXT
00429 };
00430 
00431 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop9 = {
00432    0x30C8                                  // First character
00433   ,0x30C8                                  // Last character 
00434   ,&_GUI_FontJapanese_text16_CharInfo[ 10] // Address of first character
00435   ,&_GUI_FontJapanese_text16_Prop10        // Pointer to next GUI_FONT_PROP_EXT
00436 };
00437 
00438 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop8 = {
00439    0x30B5                                  // First character
00440   ,0x30B5                                  // Last character 
00441   ,&_GUI_FontJapanese_text16_CharInfo[  9] // Address of first character
00442   ,&_GUI_FontJapanese_text16_Prop9         // Pointer to next GUI_FONT_PROP_EXT
00443 };
00444 
00445 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop7 = {
00446    0x307E                                  // First character
00447   ,0x307E                                  // Last character 
00448   ,&_GUI_FontJapanese_text16_CharInfo[  8] // Address of first character
00449   ,&_GUI_FontJapanese_text16_Prop8         // Pointer to next GUI_FONT_PROP_EXT
00450 };
00451 
00452 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop6 = {
00453    0x306A                                  // First character
00454   ,0x306A                                  // Last character 
00455   ,&_GUI_FontJapanese_text16_CharInfo[  7] // Address of first character
00456   ,&_GUI_FontJapanese_text16_Prop7         // Pointer to next GUI_FONT_PROP_EXT
00457 };
00458 
00459 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop5 = {
00460    0x3055                                  // First character
00461   ,0x3056                                  // Last character 
00462   ,&_GUI_FontJapanese_text16_CharInfo[  5] // Address of first character
00463   ,&_GUI_FontJapanese_text16_Prop6         // Pointer to next GUI_FONT_PROP_EXT
00464 };
00465 
00466 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop4 = {
00467    0x006D                                  // First character
00468   ,0x006E                                  // Last character 
00469   ,&_GUI_FontJapanese_text16_CharInfo[  3] // Address of first character
00470   ,&_GUI_FontJapanese_text16_Prop5         // Pointer to next GUI_FONT_PROP_EXT
00471 };
00472 
00473 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop3 = {
00474    0x0069                                  // First character
00475   ,0x0069                                  // Last character 
00476   ,&_GUI_FontJapanese_text16_CharInfo[  2] // Address of first character
00477   ,&_GUI_FontJapanese_text16_Prop4         // Pointer to next GUI_FONT_PROP_EXT
00478 };
00479 
00480 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop2 = {
00481    0x0065                                  // First character
00482   ,0x0065                                  // Last character 
00483   ,&_GUI_FontJapanese_text16_CharInfo[  1] // Address of first character
00484   ,&_GUI_FontJapanese_text16_Prop3         // Pointer to next GUI_FONT_PROP_EXT
00485 };
00486 
00487 static GUI_CONST_STORAGE GUI_FONT_PROP_EXT _GUI_FontJapanese_text16_Prop1 = {
00488    0x0057                                  // First character
00489   ,0x0057                                  // Last character 
00490   ,&_GUI_FontJapanese_text16_CharInfo[  0] // Address of first character
00491   ,&_GUI_FontJapanese_text16_Prop2         // Pointer to next GUI_FONT_PROP_EXT
00492 };
00493 
00494 static GUI_CONST_STORAGE GUI_FONT _GUI_FontJapanese_text16 = {
00495    GUI_FONTTYPE_PROP_EXT // Type of font   
00496   ,16                    // Height of font 
00497   ,16                    // Space of font y
00498   ,1                     // Magnification x
00499   ,1                     // Magnification y
00500   ,{&_GUI_FontJapanese_text16_Prop1}
00501   ,14                    // Baseline
00502   ,8                     // Height of lowercase characters
00503   ,13                    // Height of capital characters
00504 };
00505 
00506 /*********************************************************************
00507 *
00508 *       Language texts
00509 *
00510 **********************************************************************
00511 */
00512 static U8 _acLangGer[] = {
00513   "Deutsch"CRLF
00514   "emWin"CRLF
00515   "unterst\xc3\xbctzt"CRLF
00516   "verschiedene"CRLF
00517   "Sprachen"
00518 };
00519 
00520 static U8 _acLangEng[] = {
00521   "English"CRLF
00522   "emWin"CRLF
00523   "supports"CRLF
00524   "different"CRLF
00525   "languages"CRLF
00526 };
00527 
00528 static U8 _acLangJap[] = {
00529   "\xe6\x97\xa5\xe6\x9c\xac\xe4\xba\xba"CRLF
00530   "emWin"CRLF
00531   "\xe3\x82\xb5\xe3\x83\x9d\xe3\x83\xbc\xe3\x83\x88"CRLF
00532   "\xe3\x81\x95\xe3\x81\xbe\xe3\x81\x96\xe3\x81\xbe\xe3\x81\xaa"CRLF
00533   "\xe8\xa8\x80\xe8\xaa\x9e"CRLF
00534 };
00535 
00536 /*********************************************************************
00537 *
00538 *       Language context
00539 *
00540 **********************************************************************
00541 */
00542 typedef struct {
00543   U8             * pLanguage;
00544   U32              NumChars;
00545   const GUI_FONT * pFontHeadline;
00546   const GUI_FONT * pFontBody;
00547 } LANGUAGE_CONTEXT;
00548 
00549 static LANGUAGE_CONTEXT _Languages[] = {
00550   { _acLangGer, sizeof(_acLangGer), &GUI_Font16B_1,                &GUI_Font16_1  },
00551   { _acLangEng, sizeof(_acLangEng), &GUI_Font16B_1,                &GUI_Font16_1  },
00552   { _acLangJap, sizeof(_acLangJap), &_GUI_FontJapanese_headline16, &_GUI_FontJapanese_text16 }
00553 };
00554 
00555 static U8 _NumLanguages = GUI_COUNTOF(_Languages);
00556 
00557 /*********************************************************************
00558 *
00559 *       MainTask
00560 */
00561 void MainTask(void) {
00562   const char * pText;
00563   GUI_RECT     Rect;
00564   int          xItemSize;
00565   int          yItemSize;
00566   int          NumItems;
00567   int          LangCnt;
00568   int          ItemCnt;
00569   int          xSize;
00570   int          ySize;
00571 
00572   GUI_Init();
00573   //
00574   // Check if recommended memory for the sample is available
00575   //
00576   if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
00577     GUI_ErrorOut("Not enough memory available."); 
00578     return;
00579   }
00580   xSize   = LCD_GetXSize();
00581   ySize   = LCD_GetYSize();
00582   Rect.x0 = 0;
00583   Rect.y0 = 0;
00584   Rect.x1 = xSize        - 1;
00585   Rect.y1 = SPACE_TO_TOP - 1;
00586   GUI_SetFont(&GUI_Font20B_1);
00587   GUI_SetTextMode(GUI_TM_TRANS);
00588   GUI_SetBkColor(GUI_DARKBLUE);
00589   GUI_ClearRectEx(&Rect);
00590   GUI_DispStringInRect("emWin - Language Resources", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
00591   GUI_DrawGradientV(0, SPACE_TO_TOP, xSize - 1, ySize - 1, GUI_DARKBLUE, GUI_DARKGRAY);
00592   GUI_UC_SetEncodeUTF8();
00593   GUI_LANG_SetMaxNumLang(_NumLanguages);
00594   for (LangCnt = 0; LangCnt < _NumLanguages; LangCnt++) {
00595     GUI_LANG_LoadText(_Languages[LangCnt].pLanguage, _Languages[LangCnt].NumChars, LangCnt);
00596     xItemSize = xSize / _NumLanguages;
00597     Rect.x0   = LangCnt * xItemSize;
00598     Rect.x1   = Rect.x0 + xItemSize;
00599     NumItems  = GUI_LANG_GetNumItems(LangCnt);
00600     yItemSize = (ySize - SPACE_TO_TOP) / NumItems;
00601     for (ItemCnt = 0; ItemCnt < NumItems; ItemCnt++) {
00602       pText   = GUI_LANG_GetTextEx(ItemCnt, LangCnt);
00603       Rect.y0 = SPACE_TO_TOP + (ItemCnt * yItemSize);
00604       Rect.y1 = Rect.y0 + yItemSize;
00605       if (ItemCnt == 0) {
00606         GUI_SetFont(_Languages[LangCnt].pFontHeadline);
00607       } else {
00608         GUI_SetFont(_Languages[LangCnt].pFontBody);
00609       }
00610       GUI_DispStringInRect(pText, &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
00611     }
00612   }
00613   while (1) {
00614     GUI_Delay(100);
00615   }
00616 }
00617 
00618 /*************************** End of file ****************************/