Post by John on Apr 30, 2019 6:52:45 GMT -8
Hi,
I was trying to display Chinese characters on screen with the GD2 library. The Arduino serial monitor can display the Chinese characters but not the touch screen. From FTDI there are a few tutorials, however the code they provide is a little different to the GD2 library. I found an Arduino solution but its a little complex because it uses a different screen driver and the SD card reading is based on sectors which is difficult. The solution seems to be using some kind of escape sequence (\x) when its used with the cmd_text and cmd_button functions.
So the format equivalent for GD.cmd_button() would be,
Ft_Gpu_CoCmd_Button(phost,FT_DispWidth*0.001,(FT_DispHeight*0.70),(FT_DispWidth*0.124),(FT_DispHeight*0.112),Y_Z_HANDLE,But_opt,"\x1B\x1C");
where the text "\x1B\x1C" is somehow related to the Chinese characters. So initially a file is read in from the SD card which holds data for the Chinese characters. This is then loaded into the screen drivers memory and stored as a bitmap.
#define Y_Z_FILE_ADDR (S_X_FILE_ADDR + 28708)
#define Y_Z_HANDLE 5
#define Y_Z_SOURCE (Y_Z_FILE_ADDR+148-34*14*INDEX_BASE)
readfile2flash("Y-Z_SC.raw", Y_Z_FILE_ADDR);
Ft_App_WrCoCmd_Buffer(phost,BITMAP_HANDLE(Y_Z_HANDLE));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_SOURCE(Y_Z_SOURCE));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_LAYOUT(L4,14,34));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_SIZE(NEAREST,BORDER,BORDER,28,34));
Ft_Gpu_CoCmd_SetFont(phost, Y_Z_HANDLE, Y_Z_FILE_ADDR);
You can see the equivalent GD2 functions used in this FT driver. eg
- GD.BitmapHandle(),
- GD.BitmapSource(),
- GD.BitmapLayout(),
- GD.BitmapSize(),
- GD.cmd_setfont();
The link to the example is here below. In the link its under example 22 (Chinese Font), which gives the sample Arduino code, the documentation and the raw data files.
brtchip.com/softwareexamples-eve/
In addition there is a document on multiple language font here below.
www.ftdichip.com/Support/Documents/AppNotes/AN_291_FT800_Create_Multi-Language_Font.pdf
I think this example is for the FT800 but i m using the FT810. Should that matter if its using this special escape character bitmap thing?
If this was in the GD2 library it would be awesome because i m having a lot of difficulty understanding how to translate this to GD2. Any help would be much appreciated.
Thanks,
I was trying to display Chinese characters on screen with the GD2 library. The Arduino serial monitor can display the Chinese characters but not the touch screen. From FTDI there are a few tutorials, however the code they provide is a little different to the GD2 library. I found an Arduino solution but its a little complex because it uses a different screen driver and the SD card reading is based on sectors which is difficult. The solution seems to be using some kind of escape sequence (\x) when its used with the cmd_text and cmd_button functions.
So the format equivalent for GD.cmd_button() would be,
Ft_Gpu_CoCmd_Button(phost,FT_DispWidth*0.001,(FT_DispHeight*0.70),(FT_DispWidth*0.124),(FT_DispHeight*0.112),Y_Z_HANDLE,But_opt,"\x1B\x1C");
where the text "\x1B\x1C" is somehow related to the Chinese characters. So initially a file is read in from the SD card which holds data for the Chinese characters. This is then loaded into the screen drivers memory and stored as a bitmap.
#define Y_Z_FILE_ADDR (S_X_FILE_ADDR + 28708)
#define Y_Z_HANDLE 5
#define Y_Z_SOURCE (Y_Z_FILE_ADDR+148-34*14*INDEX_BASE)
readfile2flash("Y-Z_SC.raw", Y_Z_FILE_ADDR);
Ft_App_WrCoCmd_Buffer(phost,BITMAP_HANDLE(Y_Z_HANDLE));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_SOURCE(Y_Z_SOURCE));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_LAYOUT(L4,14,34));
Ft_App_WrCoCmd_Buffer(phost,BITMAP_SIZE(NEAREST,BORDER,BORDER,28,34));
Ft_Gpu_CoCmd_SetFont(phost, Y_Z_HANDLE, Y_Z_FILE_ADDR);
You can see the equivalent GD2 functions used in this FT driver. eg
- GD.BitmapHandle(),
- GD.BitmapSource(),
- GD.BitmapLayout(),
- GD.BitmapSize(),
- GD.cmd_setfont();
The link to the example is here below. In the link its under example 22 (Chinese Font), which gives the sample Arduino code, the documentation and the raw data files.
brtchip.com/softwareexamples-eve/
In addition there is a document on multiple language font here below.
www.ftdichip.com/Support/Documents/AppNotes/AN_291_FT800_Create_Multi-Language_Font.pdf
I think this example is for the FT800 but i m using the FT810. Should that matter if its using this special escape character bitmap thing?
If this was in the GD2 library it would be awesome because i m having a lot of difficulty understanding how to translate this to GD2. Any help would be much appreciated.
Thanks,