Jump to content

Does ugfx can display a chineese character?


jayjiang

Recommended Posts

Hello jayjian and welcome to the community!

To your original post: Yes, uGFX supports chinese character rendering due to UTF-8 support. We also had at least one customer who successfully uses uGFX with chinese fonts in the past.

However, none of the uGFX developers knows chinese. Therefore, it is very difficult for us to verify that it is working properly. It seems like there are different "version" of chienese, with different encodings and even different alphabets. We already fail at the stage where we need to make sure that we got a font that can be used with a random sentence that we copied off the internet somewhere.

Anyway: We downloaded a random font and a random sentence and we definitely get something displayed. Whether that is proper chinese or not - we cannot say. The characters seem to match at least and provided the fact that a chinese customer used uGFX with chinese fonts without ever complaining should mean that it can uGFX can be used to handle chinese fonts.

We took some free TTF chinese font, uploaded it to the font converted, disabled the filter and got all the converted glyphs back. Seems to work so far on our side.

We are sorry that we can't really help you any better.

~ Tectu

Link to comment
Share on other sites

1.For this question, I download the mcufont encoder' s source file and compile it into windows execute file. I found the offset table' s size is limited by 64KB. for Chinese character,is not enough. So may be you guys can check it again.

2.I wonder if I could display Chinese on widgets?

3.I want to display the file name(Chinese) which read from FatFs but FatFs will convert it from unicode to cc396(GBK). I must convert it to unicode then to UTF8 for display. So I want to know if ugfx can support UTF16(I know mcufont is support it, but ugfx' s widgets (e.g. list) is not support)?

Link to comment
Share on other sites

Currently any string handling in ugfx is based on 8 bit characters (ascii, utf8 etc).

Changing to 16 bit characters would require appropriate source code modifications.

If you would like to attempt this we would love the contribution.

I would suggest a new type called "gfxchar" whose definition is based on a gfxconf.h macro eg GFX_NEED_CHAR16.

Link to comment
Share on other sites

if _LFN_UNICODE marco is disabled, fatfs libary will convert the LFN from unicode to codepage(eg. 936 or ascii). Codepage could not directly convert to utf8 and need convert back to unicode first. I hope you understand what I am saying because my english grammar is poor.

Link to comment
Share on other sites

Hey,

I don't think you need UTF-16 to make it work if you fix the offset table size limit.

However in case of languages not using the latin alphabet (or very little of it), it would be more efficient as most characters will need 3 bytes in UTF-8, and only 2 in UTF-16.

Link to comment
Share on other sites

While encoding as UTF8 requires more storage than UTF16 for chinese, UTF-16 requires a whole new set of string handling functions which means that unless you have lots and lots of text any gains from moving to UTF-16 is lost in the extra code required.

Never the less, I have just finished another little side project (re-invigorating the Arduino port of ugfx) so I will work on this next.

The first problem to be solved is the offset table produced by the mcufont encoder (and its corresponding ugfx decoding code).

Once that is done I will look at adding UTF-16 support and if it is simple enough I will add that too.

Expect the process to take a week or so.

Link to comment
Share on other sites

Hey,

I don't think you need UTF-16 to make it work if you fix the offset table size limit.

However in case of languages not using the latin alphabet (or very little of it), it would be more efficient as most characters will need 3 bytes in UTF-8, and only 2 in UTF-16.

yes, for now I use a function to convert utf16 to utf8 and then display it. it works fine.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 years later...

I am trying to convert .otf format of my font using your linux mcufont converter. I am also missing some characters in different font sizes. Does anyone know what is this about?

I am filtering my font so it won't be too big. 

I am missing some characters in size 14, but when I change my size to 16 it shows it correctly. but there is also a character that I can't show it in either sizes. 

Is that because I am using otf format and my command in import_ttf ?  I didn't find any other solution to create my .c files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...