|
eric老师,sd卡xbf字库我卡在了一个地方,
例程的移植是成功了,可是中文没有办法显示,而且我不知道应该什么时候关闭字库文件,而且要如何用在空间上,(在我把BUTTON_SetDefaultFont这些设置成xbf的时候,无法显示文字),还有我网上下的全功能fontcvt似乎不能用,都是乱码的,只好拿别人现成的用,请问有地方能搞到可以用的么?
这是我用fatfs移植xbf的文件
#include "GUI.h"
#include "ff.h"
GUI_FONT XBFFont;
GUI_XBF_DATA XBF_Data;
static int _cbGetData(U32 Off, U16 NumBytes, void * pVoid, void * pBuffer) {
FIL fsrc; // ֨ӥτݾәط`
FRESULT res; // ֨ӥәطޡڻҤ
UINT br;
char string[30];
fsrc = *(FIL *)pVoid;
/* Set file pointer to the requested position */
res = f_lseek(&fsrc,Off); //֒ս˗ַ֘
if (res != FR_OK) {
return 1; /* Error */
}
res=f_read(&fsrc,pBuffer,NumBytes,&br);
// pBuffer=string;
// res=f_read(&fsrc,pBuffer,NumBytes,&br);
// pBuffer=&string;
if (res != FR_OK) {
return 1; /* Error */
}
// /* Read font data */
// if (!ReadFile(hFile, pBuffer, NumBytes, &NumBytesRead, 0)) {
// return 1; /* Error */
// }
if (br != NumBytes) {
return 1; /* Error */
}
return 0; /* Ok */
}
void readFontfromXBFSD(void){
FIL fsrc; // ֨ӥτݾәط`
FRESULT res; // ֨ӥәطޡڻҤ
res = f_open(&fsrc, "0:/sys/NEW12.xbf", FA_OPEN_EXISTING | FA_READ);
GUI_XBF_CreateFont(&XBFFont, /* Pointer to GUI_FONT structure in RAM */
&XBF_Data, /* Pointer to GUI_XBF_DATA structure in RAM */
GUI_XBF_TYPE_PROP, /* Font type to be created */
_cbGetData, /* Pointer to callback function */
&fsrc); /* Pointer to be passed to GetData function */
//GUI_SetFont(&XBFFont);
//GUI_DispStringAt("Hello world!中文", 160, 80);
//GUI_Clear();
//res = f_close(&fsrc); //ژҕؖͥ
}
GUI_DispStringAt("Hello world!中文", 160, 80);的时候,中文没办法显示出来 |
|