|

楼主 |
发表于 2019-11-11 10:45:04
|
显示全部楼层
本帖最后由 wen 于 2019-11-11 11:31 编辑
XBF,存储在nand flash 上,fat32,两种字体,如果有一处大字体丢了,其他页面的大字体也丢了;小字体也是一样的
u8 Create_XBF16(u8 *fxpath)
{
int result;
result = f_open(&XBF16FontFile,(const TCHAR*)fxpath,FA_READ); //打开字库文件
if(result != FR_OK) return 1;
/* 创建XBF16字体 */
GUI_XBF_CreateFont( &XBF16_Font, //指向GUI_FONT结构
&XBF16_Data, //指向GUI_XBF_DATA结构
GUI_XBF_TYPE_PROP_AA2_EXT,//要创建的字体类型
_cbGetData, //回调函数
&XBF16FontFile); //窗体给回调函数_cbGetData的参数
return 0;
}
static int _cbGetData(U32 Off, U16 NumBytes, void * pVoid, void * pBuffer)
{
int result;
u16 bread;
FIL *hFile;
hFile = (FIL*)pVoid;
/* 设置在文件中的偏移(位置) */
result = f_lseek(hFile,Off);
if(result != FR_OK) return 1; //返回错误
taskENTER_CRITICAL(); //进入临界区
result = f_read(hFile,pBuffer,NumBytes,(UINT *)&bread); //读取数据
taskEXIT_CRITICAL(); //退出临界区
if(result != FR_OK) return 1; //返回错误
return 0;
} |
|