I want to better understand how the eGUI TWR-K70 Demo is able to reference the Chinese characters. My objective is to be able to add English words, for example the word "Frequency", and be able to reference the unicode and ultimately draw the Chinese character bitmap on the LCD. I'll break this down into a few questions, and I'd be glad to mark "Correct Answer" for answers to any of these sub questions.
1) From what I understand, the first 2 bytes of unicode are the Basic Multilingual Plane which contains almost all modern languages, where about half of these codes are used to encode Chinese characters. If this is correct, then why do the wide character arrays in strings.c which appear to contain unicodes have 6 bytes rather than 2 bytes? Please refer me to a source document which explains this.
2) If these arrays indeed contain unicodes, then where are the actual Chinese character bitmaps, and what is the code linkage between these unicodes and the character bitmaps?
3) How can I convert an English word to the unicode for the Chinese translation? There are many converters available, but they all seem to convert from English directly to the Chinese character and not give the unicode.
4) Is there a more complete library of the the Chinese character bitmaps? I could use the eGUI Converter utility (which incidentally is a well-done tool) to convert individual characters but this would take quite some time.
Thanks,
Gene
已解决! 转到解答。
2) In the file "fonts.c" are declared the fonts "d4dfnt_CourierNew12_desc" and "d4dfnt_Arial12_desc". Its characters are described in that file through tables. These fonts are variables of the type "D4D_FONT_DESCRIPTOR" which is a structure where one variable is a pointer to the next page (const struct D4D_FONT_DESCRIPTOR_S* pNext). In the Arial and Courier New fonts are described the "normal" characters (the first table) and the Chinese ones (since the second page). So if you need a Chinese character you need to use one of these fonts, that's why I said that the "English" and the "Chinese" characters are linked by the same way.
3) You are right, it is a two-step process. I translated in Google translate the word Open (from English to Chinese Simplified), it trows more than one result (you can click in the translated word to see all the options) and one of these is 打开, if you go to the Unicode converter you can see that it Unicode is 0x6253 and 0x5F00, the same as the eGUI demo. I am afraid you need a good Chinese translator.
4) For the example I downloaded from Cool Text: Download Free Unicode Chinese Fonts - this font which contains the Chinese characters. I installed the font in Windows and then in the "Freescale Embedded GUI Converter Utility 3.0" in the tab "Font Converter Utility" I imported the font (it appears as @HanWangWCL07).
Then in the tab "Character Table Settings" select "Unicode 16-bit" encoding and press the "Unicode Range", select the option "CJK Unified Ideographs" which are the fonts from the 0x4E00 to 0x9FB0 Unicodes, then click "Ok" and "Apply".
.
Nos, you have all the Chinese characters in the main window, you can go through pages in the menu shown in the image. For example, if you select the page 95 you will see the character 开 (which is used in the wor "Open") with the Unicode 0x5F00.
Now you can create your .d4l file or a .h and a .c files which the data that you need.
Best regards,
Earl Orlando.
Hello again Gene,
1) From what I understand, the first 2 bytes of unicode are the Basic Multilingual Plane which contains almost all modern languages, where about half of these codes are used to encode Chinese characters. If this is correct, then why do the wide character arrays in strings.c which appear to contain unicodes have 6 bytes rather than 2 bytes? Please refer me to a source document which explains this.
The first Basic Multilingual Plane (BMP) which contains the first 65,536 code point positions in the Unicode (represented by two bytes) is the plane used so the 2 bytes used in the file "strings.c" represents these characters. You can see a better explanation in the next link Character encodings: Essential concepts .
Unicode (from Wikipedia):
The 214 Kangxi radicals act as a de facto standard, which may not be duplicated exactly in every Chinese dictionary, but which few dictionary compilers can afford to completely ignore. They serve as the basis for many computer encoding systems. Specifically, the Unicode standard's radical-stroke charts are based on the Kangxi radicals or radicals. The count of commonly used radicals in modern abridged dictionaries is often less than 214.
2) If these arrays indeed contain unicodes, then where are the actual Chinese character bitmaps, and what is the code linkage between these unicodes and the character bitmaps?
The characters (Chinese and Latin) are described in the file "fonts.c". also, you can add .d4l files which contains this data. The linkage is the same for English and Chinese. This is made in the function "D4D_ChangeStringTable" in the file "d4d_string.c". You can generate these arrays or d4l files with the "Freescale Embedded GUI Converter Utility 3.0".
3) How can I convert an English word to the unicode for the Chinese translation? There are many converters available, but they all seem to convert from English directly to the Chinese character and not give the unicode.
I found this converter but not all the Chinese characters are defined in the file "fonts.c".
4) Is there a more complete library of the the Chinese character bitmaps? I could use the eGUI Converter utility (which incidentally is a well-done tool) to convert individual characters but this would take quite some time.
You can convert an entire font file into arrays in the "Freescale Embedded GUI Converter Utility 3.0" (Font Converter Utility tab > Import Font) so you can download a font library which contains Chinese characters.
I hope I solved your doubts.
Best regards,
Earl Orlando.
Thanks Earl. Again, no Correct Answer button appears so I can only click Helpful. Karla Denisse from Freescale is working on this.
1) Ok, I see that each array contains a series of 2-byte UTF-16 character codes, where for example the word "Open" requires two Chinese characters with codes 0x6253 and 0x5f00. I have a hard time understanding the structure of the Chinese characters, but it appears that the 214 Kangxi Radicals are merely classifiers and that a fairly complete set of characters is in the thousands. This is still ok, see (3).
2) In fonts.c I don't see any reference to Chinese characters. I see comments which seem like they would fall into the Chinese character unicode space such as "character 0x578B" but the name of the array is "d4dfnt_CourierNew12_Page_87_data_table".
3) Here is the most important question. I still don't see how I can translate and English word to the UTF-16 unicode(s) which encodes the Chinese character(s) which has the same meaning as the English word. The converter you referenced only converts between a symbol and it's unicode. Ahhh, I see, it's a two-step process - first use an English-to-Chinese character converter, then enter the Chinese character into your converter which gives the sequence of unicodes. I tried this on the word "Open" and it gave 0x5f00 0x653e which is not the same as 0x6253 and 0x5f00 in the strings.c array. Something is in error here.
4) So the Converter Utility can convert a page full of characters into a whole set of data arrays? How does it manage variable white spaces between characters?
2) In the file "fonts.c" are declared the fonts "d4dfnt_CourierNew12_desc" and "d4dfnt_Arial12_desc". Its characters are described in that file through tables. These fonts are variables of the type "D4D_FONT_DESCRIPTOR" which is a structure where one variable is a pointer to the next page (const struct D4D_FONT_DESCRIPTOR_S* pNext). In the Arial and Courier New fonts are described the "normal" characters (the first table) and the Chinese ones (since the second page). So if you need a Chinese character you need to use one of these fonts, that's why I said that the "English" and the "Chinese" characters are linked by the same way.
3) You are right, it is a two-step process. I translated in Google translate the word Open (from English to Chinese Simplified), it trows more than one result (you can click in the translated word to see all the options) and one of these is 打开, if you go to the Unicode converter you can see that it Unicode is 0x6253 and 0x5F00, the same as the eGUI demo. I am afraid you need a good Chinese translator.
4) For the example I downloaded from Cool Text: Download Free Unicode Chinese Fonts - this font which contains the Chinese characters. I installed the font in Windows and then in the "Freescale Embedded GUI Converter Utility 3.0" in the tab "Font Converter Utility" I imported the font (it appears as @HanWangWCL07).
Then in the tab "Character Table Settings" select "Unicode 16-bit" encoding and press the "Unicode Range", select the option "CJK Unified Ideographs" which are the fonts from the 0x4E00 to 0x9FB0 Unicodes, then click "Ok" and "Apply".
.
Nos, you have all the Chinese characters in the main window, you can go through pages in the menu shown in the image. For example, if you select the page 95 you will see the character 开 (which is used in the wor "Open") with the Unicode 0x5F00.
Now you can create your .d4l file or a .h and a .c files which the data that you need.
Best regards,
Earl Orlando.