/** ****************************************************************************** * @file fonts.h * @author MCD Application Team * @version V1.0.0 * @date 18-February-2014 * @brief Header for fonts.c file ****************************************************************************** * @attention * *

© COPYRIGHT(c) 2014 STMicroelectronics

* * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __FONTS_H #define __FONTS_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include /** @addtogroup Utilities * @{ */ /** @addtogroup STM32_EVAL * @{ */ /** @addtogroup Common * @{ */ /** @addtogroup FONTS * @{ */ /** @defgroup FONTS_Exported_Types * @{ */ typedef struct _tFont { const uint8_t *table; uint16_t Width; uint16_t Height; } sFONT; extern sFONT Font24; extern sFONT Font20; extern sFONT Font16; extern sFONT Font12; extern sFONT Font8; /** * @} */ /** @defgroup FONTS_Exported_Constants * @{ */ #define LINE(x) ((x) * (((sFONT *)LCD_GetFont())->Height)) /*******************中文********** 在显示屏上显示的字符大小 ***************************/ #define WIDTH_CH_CHAR 24 //中文字符宽度 #define HEIGHT_CH_CHAR 24 //中文字符高度 //0表示使用SD卡字模,非零表示FLASH字模,由于SD卡字模有文件系统,速度慢很多。 #define GBKCODE_FLASH 1 #if GBKCODE_FLASH /*使用FLASH字模*/ /*=========================================================================================*/ /*中文字库存储在FLASH的起始地址*/ /*FLASH*/ //#define GBKCODE_START_ADDRESS 1360*4096 /* 资源烧录到的FLASH基地址(目录地址) */ #define RESOURCE_BASE_ADDR (16*1024*1024) /* 存储在FLASH中的资源目录大小 */ #define CATALOG_SIZE (8*1024) /* 字库目录信息类型 */ typedef struct { char name[40]; /* 资源的名字 */ uint32_t size; /* 资源的大小 */ uint32_t offset; /* 资源相对于基地址的偏移 */ }CatalogTypeDef; /*=========================================================================================*/ /*获取字库的函数*/ //定义获取中文字符字模数组的函数名,ucBuffer为存放字模数组名,usChar为中文字符(国标码) #define GetGBKCode( ucBuffer, usChar ) GetGBKCode_from_EXFlash( ucBuffer, usChar ) int GetGBKCode_from_EXFlash( uint8_t * pBuffer, uint16_t c); int GetResOffset(const char *res_name); #else /*使用SD字模*/ /*SD卡字模路径*/ #define GBKCODE_FILE_NAME "0:/Font/GB2312_H2424.FON" /*获取字库的函数*/ //定义获取中文字符字模数组的函数名,ucBuffer为存放字模数组名,usChar为中文字符(国标码) #define GetGBKCode( ucBuffer, usChar ) GetGBKCode_from_sd( ucBuffer, usChar ) int GetGBKCode_from_sd ( uint8_t * pBuffer, uint16_t c); #endif /** @defgroup FONTS_Exported_Macros * @{ */ /** * @} */ /** @defgroup FONTS_Exported_Functions * @{ */ /** * @} */ #ifdef __cplusplus } #endif #endif /* __FONTS_H */ /** * @} */ /** * @} */ /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/