资源简介
现在的UC/GUI的源程序只能实现部分英文字库,但我们中国人开发项目常常要用中国字,网上关于实现汉字的方法的文章太多了,随便可以找到,但是那都是将少量的字库文件存放在片内的FLASH,一旦在不确定汉字使用范围的时候那就麻烦了,要将整个字库文件编进去的话那个头就太大了,因此只能外加片外FLASH了,这样就要修改UC/GUI的源码了。

代码片段和文件信息
/*
*********************************************************************************************************
* uC/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002 Micrium Inc. Weston FL
* (c) Copyright 2002 SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI is protected by international copyright laws. Knowledge of the
* source code may not be used to write a similar product. This file may
* only be used in accordance with a license and should not be redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : GUICharP.C
Purpose : Implementation of Proportional fonts
---------------------------END-OF-HEADER------------------------------
*/
#include /* needed for definition of NULL */
#include “GUI_Private.h“
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
//字模数据的暂存数组以单个字模的最大字节数为设定值
#define BYTES_PER_FONT 64
static U8 GUI_FontDataBuf[BYTES_PER_FONT];
/*********************************************************************
*
* GUIPROP_FindChar
*/
static const GUI_FONT_PROP GUI_UNI_PTR * GUIPROP_FindChar(const GUI_FONT_PROP GUI_UNI_PTR* pProp U16P c) {
for (; pProp; pProp = pProp->pNext) {
if ((c>=pProp->First) && (c<=pProp->Last))
break;
}
return pProp;
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUIPROP_DispChar
*
* Purpose:
* This is the routine that displays a character. It is used by all
* other routines which display characters as a subroutine.
*/
void GUIPROP_DispChar(U16P c) {
int BytesPerLine;
U8 BytesPerFont;
U32 baseoft;
GUI_DRAWMODE DrawMode = GUI_Context.TextMode;
const GUI_FONT_PROP GUI_UNI_PTR * pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp c);
if (pProp) {
GUI_DRAWMODE OldDrawMode;
const GUI_CHARINFO GUI_UNI_PTR * pCharInfo;
if(GUI_Context.pAFont == &GUI_FontHZ_SimHei_20)
{
pCharInfo = pProp->paCharInfo;
base = (U32)pProp->paCharInfo->pData;
BytesPerFont = GUI_Context.pAFont->YSize * pProp->paCharInfo->BytesPerLine; //每个字模的数据字节数
if (BytesPerFont > BYTES_PER_FONT)
{
BytesPerFont = BYTES_PER_FONT;
}
if (c < 0x80) //英文字符地址偏移算法
{
oft = base + (c - 0x20) * BytesPerFont;
}
else //中文字符地址偏移算法
{
if((c>>8) >= 0xb0)
oft = base + (((c>>8) - 0xa1 - 6) * 94 + ((c&0xff) - 0xa1)) * B
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 17899 2010-12-26 17:16 SimHei_20.c
文件 5889 2010-12-27 09:54 GUICharP.c
文件 239 2010-12-31 10:28 readme.txt
----------- --------- ---------- ----- ----
24027 3
相关资源
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
评论
共有 条评论