安富莱 STM32-V5 开发板 STemWin 教程 第 1 页 共 11 页 第19章 汉字显示方式二(放到外部存储器) 本期教程主要讲如何将字库放置到外部存储器的方法,这里以放到 SD卡为例,放到其他存储器是一样的。本章教程提供的方法是以前 UCGUI时代遗留下来的,这种方法相对于后面要讲到的 XBF方式还是有差距的(官方推荐方式)。不过为了照顾以前从 UCGUI转战过来的,写了这么一期教程。 19. 1 移植方法 19. 2 总结 19.1 移植方法 19.1.1 第一步:添加相关文件 在工程的 emWin文件夹中新建一个 HanZi文件夹,主要有以下几个文件: 安富莱 STM32-V5 开发板 STemWin 教程 第 2 页 共 11 页 19.1.2 第二步:将这几个文件添加到工程 19.1.3 第三步:GUI_UC_EncodeNone.c 文件内容 #include "GUI_Private.h" /********************************************************************* * * Static code * ********************************************************************** */ /********************************************************************* * * _GetCharCode * * Purpose: * Return the UNICODE character code of the current character. */ static U16 _GetCharCode(const char GUI_UNI_PTR * s) { if((*s) > 0xA0) { return *(const U16 GUI_UNI_PTR *)s; } return *(const U8 GUI_UNI_PTR *)s; } /********************************************************************* * * _GetCharSize * * Purpose: 安富莱 STM32-V5 开发板 STemWin 教程 第 3 页 共 11 页 * Return the number of bytes of the current character. */ static int _GetCharSize(const char GUI_UNI_PTR * s) { GUI_USE_PARA(s); if((*s) > 0xA0) { return 2; } return 1; } /********************************************************************* * * _CalcSizeOfChar * * Purpose: * Return the number of bytes needed for the given character. */ static int _CalcSizeOfChar(U16 Char) { GUI_USE_PARA(Char); if(Char > 0xA0A0) { return 2; } return 1; } /********************************************************************* * * _Encode * * Purpos...