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.

Tivaware graphics library grStringDrawCentered Latin and Chinese (non-western) strings

Hi,

I am new using the Tivaware graphics library and I am looking to draw on the an LCD chinese strings.

Right now I am using the following

string s="hello";

usprintf(pcanvasText,"%s",s);

grStringDrawCentered(&sContext,&pcanvasText,-1,Xpose,Ypos,0);

This works fine for western characters, how can I make it for non-western characters. Can anyone help me

Thanks in advance,

Armando 

  •  Hi Armando, on language demo folder of tiwaware there is an example, see also this post if can solve your need:

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/341914.aspx

  • Hi Roberto,

    Many thanks for the help. The lang demo is a really good point to start. 

    Just now I am with troubles regarding the tfrasterize. When I create a Font of 60 PT the following error appears:

    ftrasterize: Character 'd' was larger than 256 bytes!

    Can anyone help me with problem, what should I do?

    Thanks in advance 

    Miguel

  • Armando Pinto said:

    Just now I am with troubles regarding the tfrasterize. When I create a Font of 60 PT the following error appears:

     Hi Miguel, on your original post I guessed you are managing chinese ideograms where support I think where on language demo..

     To try solve two more question to address what you are doing and why:

     Why are you designing a so large 60Pt font requiring a 60xYsize if square maybe in range of more than 360Bytes? A very huge font not so embedded graphics taylored to.

     Why not use a smaller font then use sizing to display 60Pt? 60 point are also a an issue to small resolution LCD of embedded environment, example a 128x192 dot can just display 2 char by 3 matrix, is this your target?

  • I Roberto,

    Many thanks for your answer. I really need for my applicantion a huge font. Right now I am using 50 Pt instead using 60pt.

    But you are absolutly right, a very huge font becomes the program really huge and the flash is limited. I tink that the best approach should be the last suggestion of yours (use a smaller font and make sizing). Can you help me on that?...tivaware graphics library has any method to do that?

    Thanks in advance,

    Armando

  • Armando Pinto said:

    But you are absolutly right, a very huge font becomes the program really huge and the flash is limited. I tink that the best approach should be the last suggestion of yours (use a smaller font and make sizing). Can you help me on that?...tivaware graphics library has any method to do that?

     Hi Armando, first if you find my answer solve your problem please check verify on one of my post too.

     

     Font are to be imported from external source so it is better to do that on PC using specialized program, do that on TIVA is quite impossible than difficult for limited resource than on a low end pc. If this is not your question please add more detail of what you need to do with font desing.

  • Hi Roberto,

    Thanks for the fast response but it is not the answer. I think I need to introduce more detail. 

    I started from the lang_demo and right now on my application I already have multi-language support like Chinese. In my application I have external buttons that are used no navigate through menus. At different menus there are presented different information...and to show this information I need to use 5 different sizes of FONTS, 15PT, 20PT, 30PT ,40PT  and 50PT.

    But with this a problem appeared:

    In total, with all this sizes of Fonts, I use about 100 KBytes of program memory, and this is a lot entering in account that I have a really limited program memory in my micro-controller.

    Therefore, I am looking for a solution to this problem. There are any way to compress the used fonts? Or any way to use only one font size (smaller like 20 PT) and use this one to perform a some kind of "sizing" in real time to obtain larger Fonts?

    Many thanks 

    Armando

  • Hello Armando,

    If the issue is of limited program memory to store the fonts then can you use an external SPI Flash to store the fonts and then retrieve the same into internal memory when the user requests a change on the LCD Panel. Would that be a suitable solution!!!

    Regards

    Amit

  • Armando Pinto said:

    But with this a problem appeared:

    In total, with all this sizes of Fonts, I use about 100 KBytes of program memory, and this is a lot entering in account that I have a really limited program memory in my micro-controller.

    Therefore, I am looking for a solution to this problem. There are any way to compress the used fonts? Or any way to use only one font size (smaller like 20 PT) and use this one to perform a some kind of "sizing" in real time to obtain larger Fonts?

     Armando, sorry if I insist and maybe you don't wish render public some information...

    controller are you using

    Display are you using

    Brief description of goal

     Did you read chapter on font on graphics user manual page 19?

    http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=spmu300&fileType=pdf

    the best solution can be the one proposed by Amit too retrieve char from an external storage, if you store a so close to your need fonts another not so agile solution can be write a function of doubling size, symply shift and reinsert pixel two time in a new var, from one byte you obtain two, example:

     0010 0110 goes to 0000 1100 0011 1100

    when a new line/row of these two bytes expansion is complete copy to next line/row to do square pixel 2x2 one

    repeat till next row/line and your double size character is ready to display.

    character font is now 4 time the original (doubled in two dimension)

    If this still is not close to your need please help us in the job of help you too.

  • Armando Pinto said:
    There are any way to compress the used fonts?

     I forgot this...

     Yes but also if supported this require memory resource in both ram and flash.

     Again deflating a compressed font in these cpu can require a long time.

  • Hi,

    I solved the problem using an SPI flash memory. I tried to implemented the function (to duplicate the font) as Roberto suggested and it worked but at the end I relized that an aditional SPI Flash solution is the better solution.

    Right now I have a multi-language support with the lnguages: Chinese, English and Spanish. I am using to create the string table the mkstringtable.exe from tiva tools.

    But now I am facing other problem, the number of independent characters exceeds 256 (actually the number of independent characters is 291). Well, when this happen, I do not how, the created table results in a bad table for the last language that I create.

    I think the mkstringtable.exe create a remapped character table  that are stored in a uint8_t vector and in that way, when the number of independent characters exceeds 256, some how the remapped index/adress of the character is casted.

    When I reduce the number of strings and then the number of independent characters to below of 256, the strings appear perfectly, in contrary, when exceeds the number 256, the strings appear messed up. How this is happenning?Can anyone help me?

    Many thanks in advance.

    Armando

  • Armando Pinto said:

    When I reduce the number of strings and then the number of independent characters to below of 256, the strings appear perfectly, in contrary, when exceeds the number 256, the strings appear messed up. How this is happenning?Can anyone help me?

     Armando, sorry for delay on answer, till about July 15 I am not so often online and I asnswer seldom and not in a timely manner.

     About your last qestion it is difficult try help you, as I asked some post before this please help us to help you, so we need have an idea what your application need perform, so if it need display free text or simply display some menu text...

     The proposable solution are more than one and you can try a multibyte language where character index is larger than 8 bit, then split between two or more tables..

     This can be obtained moving bit, the bits exceedings 8 select the page (character) the lsb byte can select character ...

     So please try help us iunderstand how can we help you.. Please read the sticky of CB1.