欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 9985|回復: 2
收起左側

STemWIN顯示中文字體

[復制鏈接]
ID:75926 發表于 2015-4-10 17:22 | 顯示全部樓層 |閱讀模式
想讓STemWIN顯示中文字體首先要移植了文件系統和STemWIN才行.
#include"GUI.h"
#include "ff.h"

GUI_XBF_DATA XBF_Data;
GUI_FONT     XBF_Font;
FIL          Fontfile;//定義文件
FRESULT result;//文件操作標準
uint32_t br,bw;//
FATFSfatfs;//定義文件系統
/*
*********************************************************************************************************
*
*       _cbGetData
*
* Function description
*   Callback function for getting font data
*
* Parameters:
*   Off      - Position of XBF file to be read文件內偏移量
*   NumBytes - Number of requested bytes需要讀取的文件數量
*   pVoid    - Application defined pointer//文件指針
*   pBuffer  - Pointer to buffer to be filled by the function讀出來的文件數據緩沖區
*
* Return value:
*   0 on success, 1 on error
*********************************************************************************************************
*/
static int _cbGetData(U32 Off, U16 NumBytes, void * pVoid, void * pBuffer)
{
FIL *FontFile;
/* The pVoid pointer may be used to get a file handle */
FontFile = (FIL *)pVoid;
/*
* Set file pointer to the required position
*/
result =f_lseek(FontFile, Off);
if (result != FR_OK)
{
return 1; /* Error */
}
/*
* Read data into buffer
*/
result = f_read(FontFile, pBuffer, NumBytes, &bw);
if (result != FR_OK)
{
return 1; /* Error */
}
return 0;
}


            f_mount(0,&fatfs);
result = f_open(&Fontfile, "0:/Font.xbf", FA_OPEN_EXISTING | FA_READ | FA_OPEN_ALWAYS);//黑色字體的字符串是 字體的文件名
if (result != FR_OK)
{
return;
}
//
// Create XBF font
//
GUI_XBF_CreateFont(&XBF_Font,       // Pointer to GUI_FONT structure in RAM(3)
&XBF_Data,         // Pointer to GUI_XBF_DATA structure in RAM
GUI_XBF_TYPE_PROP_AA4_EXT, // Font type to be created
_cbGetData,        // Pointer to callback function
&Fontfile);
GUI_UC_SetEncodeUTF8();
//紅色字體的代碼在主函數中調用
//這是顯示效果 上張圖片看看


回復

使用道具 舉報

ID:139917 發表于 2016-9-20 14:50 | 顯示全部樓層
贊                             
回復

使用道具 舉報

ID:191494 發表于 2017-4-20 09:10 | 顯示全部樓層
你好,請問用STemWIN顯示字體是鏡像的怎么辦?
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表