This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

multi language support and rendering by graphics Library TIVA ware

Dear Sir,

I want to display different languages on LCD display .  I have gone through many post and the document of the graphic library but all are confusing.

I uses the String table method.

So i made .csv as per lang_demo project and did the same perfectly i made .c and .h by using the mkstringtable and it did perfectly as per lang_demo project.

now i use the functions

GrStringTableSet, GrLanguageSet, GrStringGet 

it rendered the English language correctly,

But when i change the Chinese lang then it shows (.) Dots instead of the fonts of Chinese as per .csv 

How Could i render the Chinese fonts or korean fonts in my LCD please suggest me the solution.

// // Set the string table. // GrStringTableSet(pucTablestrings); // // Set the current language to English(US). // GrLanguageSet(GrLangEnUS);

  • Hello Smit,

    Did you use UTF8 encoding while entering the Chinese characters into the .csv file? Looks like that is required for Asian languages (as per the Readme of the "lang_demo" example).

    Which board are you using? TI board or custom board? If TI board which one?

    The "lang_demo" example already has stings in Korean and Simplified Chinese. The "language.csv" files also has strings in both these languages. Have you tried this example?

    Thanks,
    Sai
  • Dear Sai,

    I have seen that code of lang_demo.

    I m using custom Board has TM4c129Ncpdt uC.

    yes i have used the UTF8 encoding i can share with you below.

    But i dont know how to print the Chinese characters on Screen!!lang.xlsx

  • Hello Smit,

    I am not able to generate the right "language.c" and "langremap.c" files with the file you attached in the previous post.

    I modified the Makefile in the folder "./third_party/fonts/lang_demo" to pick this new file you provided. When I execute the rule to generate the "language.c" file, no errors are reported but when I execute the rule to generate "langremap.c" , lot of errors are generated. These errors indicate that "mkstringtable" does not recognize the content of the .xlsx file while remapping. The "language.c" generated does not have any valid data.

    So I changed the format of the file to .csv (I saved this file as a .csv file using Excel) and then open the file in a text editor (Notepad++), which recognizes UTF-8 format. Only the English characters are visible, and all of the non-English characters are represented by the character"?", which indicates that they are not in UTF-8 format.

    When I open the "language.csv" file provided in TivaWare with the same editor, I can see the Chinese, Korean and Japanese characters.

    I would recommend, using a text editor that recognizes UTF-8 format to create these characters and save the file as .csv, instead of using Excel. Then try to create the langremap.c file and see if it works.

    Thanks,
    Sai
  • Hello Sai,

    how to make sure that the file is compatible UTF-8 encoding.

    I have made it with the google sheet and download as .csv format but as you told me that it is not compatible then how to check the compatibility prior to put it in code?

    and is remapping required??

    bcoz in the lang_demo code they did remapping and also normal method too so i m bit confused what should i do for my application remapping or normal??

  • Hello Sai,

    i have made files" languguae.c" &"langremap.c"  Please see to it and i have attached the UTF-8 .txt of the same. please see  to it and please suggest me the next step of the same.

    //*****************************************************************************
    // 
    // langremap.c - Source file for a compressed string table.
    //
    // This is an auto-generated file.  Do not edit by hand.
    //
    //*****************************************************************************
    
    #include "grlib/grlib.h"
    
    //
    // The auto-generated string table and associated data.
    //
    const unsigned char g_pucTablelangremap[] =
    {
        //
        // Number of Strings
        //
        0x08, 0x00,
    
        //
        // Number of Languages
        //
        0x07, 0x00,
    
        //
        // Language Identifier Table
        //
        ((GrLangEnUS) & 0xff), ((GrLangEnUS) >> 8) & 0xff,
        ((GrLangDe) & 0xff), ((GrLangDe) >> 8) & 0xff,
        ((GrLangEsSP) & 0xff), ((GrLangEsSP) >> 8) & 0xff,
        ((GrLangIt) & 0xff), ((GrLangIt) >> 8) & 0xff,
        ((GrLangZhPRC) & 0xff), ((GrLangZhPRC) >> 8) & 0xff,
        ((GrLangKo) & 0xff), ((GrLangKo) >> 8) & 0xff,
        ((GrLangJp) & 0xff), ((GrLangJp) >> 8) & 0xff,
    
        //
        // Language GrLangEnUS
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x2c, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangDe
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x3a, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangEsSP
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x47, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangIt
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x55, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangZhPRC
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x64, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangKo
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x67, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangJp
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x24, 0x00, 0x00, 0x00, // STR_KOREAN
        0x28, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x6a, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Compressed String Table
        //
        0x05, 0x02, 0x0a, 0x07, 0x01, 0x08, 0x06, 0x00, 0x0f, 0x0c, 
        0x0b, 0x04, 0x08, 0x0d, 0x06, 0x00, 0x05, 0x15, 0x14, 0x0e, 
        0x12, 0x13, 0x11, 0x00, 0x10, 0x04, 0x03, 0x07, 0x01, 0x03, 
        0x02, 0x09, 0x00, 0x16, 0x17, 0x00, 0x1d, 0x1b, 0x1c, 0x00, 
        0x18, 0x19, 0x1a, 0x00, 0x1e, 0x09, 0x02, 0x1f, 0x01, 0x0a, 
        0x0b,  ' ', 0x03, 0x04, 0x01, 0x09, 0x02, 0x00, 0x1e, 0x09, 
        0x02, 0x1f, 0x01, 0x0a, 0x0b,  ' ', 0x03, 0x04, 0x01, 0x0c, 
        0x00, 0x1e, 0x09, 0x02, 0x1f, 0x01, 0x0a, 0x0b,  ' ', 0x03, 
        0x0d, 0x01,  '#', 0x02, 0x00, 0x1e, 0x09, 0x02, 0x1f, 0x01, 
        0x0a, 0x0b,  ' ', 0x03,  '"', 0x01, 0x09, 0x02, 0x0c, 0x00, 
         '.',  '-', 0x00,  '/',  '0', 0x00,  '&',  '!',  '(',  '$', 
         '%',  ')',  '+',  ',', 0x27,  '*',  '!', 0x00, 
    };
    
    //*****************************************************************************
    //
    // The following global variables and #defines are intended to aid in setting
    // up codepage mapping tables for use with this string table and an appropriate
    // font.  To use only this string table, GrLibInit may be called with a pointer
    // to the g_GrLibDefaultlangremap structure.
    //
    //*****************************************************************************
    tCodePointMap g_pCodePointMap_langremap[] =
    {
        {0x8000, 0x8000, GrMap8BitIdentity}
    };
    
    #define NUM_CODEPOINT_MAPS (sizeof(g_pCodePointMap_langremap) / sizeof(tCodePointMap))
    
    tGrLibDefaults g_GrLibDefaultlangremap =
    {
        GrDefaultStringRenderer,
        g_pCodePointMap_langremap,
        0x8000,
        NUM_CODEPOINT_MAPS,
        0
    };
    

    //*****************************************************************************
    // 
    // language.c - Source file for a compressed string table.
    //
    // This is an auto-generated file.  Do not edit by hand.
    //
    //*****************************************************************************
    
    #include "grlib/grlib.h"
    
    //
    // The auto-generated string table and associated data.
    //
    const unsigned char g_pucTablelanguage[] =
    {
        //
        // Number of Strings
        //
        0x08, 0x00,
    
        //
        // Number of Languages
        //
        0x07, 0x00,
    
        //
        // Language Identifier Table
        //
        ((GrLangEnUS) & 0xff), ((GrLangEnUS) >> 8) & 0xff,
        ((GrLangDe) & 0xff), ((GrLangDe) >> 8) & 0xff,
        ((GrLangEsSP) & 0xff), ((GrLangEsSP) >> 8) & 0xff,
        ((GrLangIt) & 0xff), ((GrLangIt) >> 8) & 0xff,
        ((GrLangZhPRC) & 0xff), ((GrLangZhPRC) >> 8) & 0xff,
        ((GrLangKo) & 0xff), ((GrLangKo) >> 8) & 0xff,
        ((GrLangJp) & 0xff), ((GrLangJp) >> 8) & 0xff,
    
        //
        // Language GrLangEnUS
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x3c, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangDe
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x4a, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangEsSP
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x57, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangIt
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x66, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangZhPRC
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x75, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangKo
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x7c, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Language GrLangJp
        //
        0x00, 0x00, 0x00, 0x00, // STR_ENGLISH
        0x08, 0x00, 0x00, 0x00, // STR_DEUTSCH
        0x10, 0x00, 0x00, 0x00, // STR_ESPANOL
        0x18, 0x00, 0x00, 0x00, // STR_ITALIANO
        0x21, 0x00, 0x00, 0x00, // STR_CHINESE
        0x28, 0x00, 0x00, 0x00, // STR_KOREAN
        0x32, 0x00, 0x00, 0x00, // STR_JAPANEASE
        0x83, 0x00, 0x00, 0x00, // STR_CONFIG
    
        //
        // Compressed String Table
        //
         'E',  'n',  'g',  'l',  'i',  's',  'h', 0x00,  'D',  'e', 
         'u',  't',  's',  'c',  'h', 0x00,  'E',  'S',  'P',  'A', 
         'N',  'O',  'L', 0x00,  'I',  't',  'a',  'l',  'i',  'a', 
         'n',  'o', 0x00, 0xe4, 0xb8, 0xad, 0xe6, 0x96, 0x87, 0x00, 
        0xed, 0x95, 0x9c, 0xea, 0xb5, 0xad, 0xec, 0x96, 0xb4, 0x00, 
        0xe6, 0x97, 0xa5, 0xe6, 0x9c, 0xac, 0xe8, 0xaa, 0x9e, 0x00, 
         'C',  'o',  'n',  'f',  'i',  'g',  'u',  'r',  'a',  't', 
         'i',  'o',  'n', 0x00,  'C',  'o',  'n',  'f',  'i',  'g', 
         'u',  'r',  'a',  't',  'i',  'e', 0x00,  'C',  'o',  'n', 
         'f',  'i',  'g',  'u',  'r',  'a',  'c',  'i', 0xc3, 0xb3, 
         'n', 0x00,  'C',  'o',  'n',  'f',  'i',  'g',  'u',  'r', 
         'a',  'z',  'i',  'o',  'n',  'e', 0x00, 0xe7, 0xbb, 0x84, 
        0xe6, 0x80, 0x81, 0x00, 0xea, 0xb5, 0xac, 0xec, 0x84, 0xb1, 
        0x00, 0xe3, 0x82, 0xb3, 0xe3, 0x83, 0xb3, 0xe3, 0x83, 0x95, 
        0xe3, 0x82, 0xa3, 0xe3, 0x82, 0xae, 0xe3, 0x83, 0xa5, 0xe3, 
        0x83, 0xac, 0xe3, 0x83, 0xbc, 0xe3, 0x82, 0xb7, 0xe3, 0x83, 
        0xa7, 0xe3, 0x83, 0xb3, 0x00, 
    };
    
    //*****************************************************************************
    //
    // The following global variables and #defines are intended to aid in setting
    // up codepage mapping tables for use with this string table and an appropriate
    // font.  To use only this string table, GrLibInit may be called with a pointer
    // to the g_GrLibDefaultlanguage structure.
    //
    //*****************************************************************************
    tCodePointMap g_pCodePointMap_language[] =
    {
        {CODEPAGE_UTF_8, CODEPAGE_UNICODE, GrMapUTF8_Unicode}
    };
    
    #define NUM_CODEPOINT_MAPS (sizeof(g_pCodePointMap_language) / sizeof(tCodePointMap))
    
    tGrLibDefaults g_GrLibDefaultlanguage =
    {
        GrDefaultStringRenderer,
        g_pCodePointMap_language,
        CODEPAGE_UTF_8,
        NUM_CODEPOINT_MAPS,
        0
    };
    

    Unused,GrLangEnUS,GrLangDe,GrLangEsSP,GrLangIt,GrLangZhPRC,GrLangKo,GrLangJp
    STR_ENGLISH,English,English,English,English,English,English,English
    STR_DEUTSCH,Deutsch,Deutsch,Deutsch,Deutsch,Deutsch,Deutsch,Deutsch
    STR_ESPANOL,ESPANOL,ESPANOL,ESPANOL,ESPANOL,ESPANOL,ESPANOL,ESPANOL
    STR_ITALIANO,Italiano,Italiano,Italiano,Italiano,Italiano,Italiano,Italiano
    STR_CHINESE,中文,中文,中文,中文,中文,中文,中文
    STR_KOREAN,한국어,한국어,한국어,한국어,한국어,한국어,한국어
    STR_JAPANEASE,日本語,日本語,日本語,日本語,日本語,日本語,日本語
    STR_CONFIG,Configuration,Configuratie,Configuración,Configurazione,组态,구성,コンフィギュレーション
    

  • It is the weekend w/in the USA - support (may) be delayed.

    If you create a very small, test file - and execute that - you may develop further insight - helpful to vendor's tech staff. The advantage of the small file is less: time/effort on your part - which should enhance "trial & error" finds/solutions...
  • Thanks cb1,

    Thank you for prompt reply. ya i will try today as per trial & error topology.
  • Hello Smit,

    The lang_utf.txt file look good. Did you check, if the "langremap" is working (when you include it in the "land_demo" example)?

    Thanks,
    Sai
  • Yes Sai i try the same and it works. thank you