|

楼主 |
发表于 2019-6-17 17:19:20
|
显示全部楼层
本帖最后由 ihavedone 于 2019-6-17 17:33 编辑
参考安富莱历程 第25章 全字库在 STemWin 上的实现(GB2312编码) 在模拟器上实现中文。
下载了 http://pan.baidu.com/s/1o8TkaHc 密码:ehvy 里面的 V6-535_STemWin实验_任意大小全字库的生成和使用方法,GB2312编码(裸机)历程
在文件 ..\V6-535_STemWin实验_任意大小全字库的生成和使用方法,GB2312编码(裸机)\emWin\HanZi\GUICharPEx.c 中,以下函数只处理了 48 点阵的情况。
/*
*********************************************************************************************************
* 函 数 名: GUI_GetDataFromMemory
* 功能说明: 读取点阵数据
* 形 参: pProp GUI_FONT_PROP类型结构
* c 字符
* 返 回 值: 无
*********************************************************************************************************
*/
static void GUI_GetDataFromMemory(const GUI_FONT_PROP GUI_UNI_PTR *pProp, U16P c)
{
U16 BytesPerFont;
U32 oft = 0, BaseAdd;
U8 code1,code2;
char *font = (char *)pProp->paCharInfo->pData;
/* 每个字模的数据字节数 */
BytesPerFont = GUI_pContext->pAFont->YSize * pProp->paCharInfo->BytesPerLine;
if (BytesPerFont > BYTES_PER_FONT)
{
BytesPerFont = BYTES_PER_FONT;
}
/* 英文字符地址偏移计算 */
if (c < 0x80)
{
if(strncmp("A48", font, 3) == 0) /* 24*48 ASCII字符 */
{
BaseAdd = 0x00;
}
oft = c * BytesPerFont + BaseAdd;
}
/* 汉字和全角字符的偏移地址计算 */
else
{
if(strncmp("H48", font, 3) == 0) /* 48*48 字符 */
{
BaseAdd = 0x00009000;
}
/* 根据汉字内码的计算公式锁定起始地址 */
code2 = c >> 8;
code1 = c & 0xFF;
oft = ((code1 - 0xA1) * 94 + (code2 - 0xA1)) * BytesPerFont + BaseAdd;
}
/* 读取点阵数据 */
sf_ReadBuffer(GUI_FontDataBuf, oft, BytesPerFont);
}
那么我下载的历程里面的 ..\DOC\font.bin 文件,是不是也只有48点阵?而不是文档里描述的 12,16,24,32点阵?
因为我按照 12,16,24,32点阵 来用的时候,显示是乱码。如果按照48点阵来使用,那么可以显示字符。
如果是只有48点阵,那么包含 12,16,24,32点阵 的字库在哪里能得到呢?
         :handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake:handshake
|
|