⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guidemo_font.c

📁 基于三星ARM44BO的GUIUC/OS-
💻 C
字号:
/***********************************************************************************************************                                                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        : GUIDEMO_Font.cPurpose     : GUIDEMO font routines----------------------------------------------------------------------*/#include <stddef.h>#include "GUI.H"#include "GUIDEMO.H"extern GUI_FLASH const GUI_FONT GUI_FontHZ16;/***********************************************************************       Static variables************************************************************************/static const GUI_FONT * _apPropFonts[] = {  &GUI_Font10S_1,  &GUI_Font8_1,  &GUI_Font13_1,  &GUI_Font13H_1,  &GUI_Font16_1,  &GUI_Font13HB_1,  0};static const GUI_FONT * _apMonoFonts[] = {  &GUI_Font4x6,  &GUI_Font6x8,  &GUI_Font8x13_1,  &GUI_Font8x8,  &GUI_Font8x15B_1,  &GUI_Font8x16,  0};static const GUI_FONT * _apDigitFonts[] = {  &GUI_FontD32,  0};static const char * _apSJIS[] = {  {"中国  重庆单片机\n \n 销售热线: 023-68790593\x0"},};/***********************************************************************       Static functions************************************************************************/static void _Label(const char * sText) {  GUI_Clear();  GUI_SetFont(&GUI_FontComic18B_1);  #if GUIDEMO_LARGE    GUI_DispStringAt(sText, 0, 20);  #else    GUI_USE_PARA(sText);  #endif}static int _GetYPos(void) {  #if GUIDEMO_LARGE    return 80;  #else    return 0;  #endif}static void _ShowCharacters(const char*s, const GUI_FONT* pFont, int IncX) {  int i;  int ix=0, y;  int FontSizeY;  GUI_SetFont(pFont);  FontSizeY = GUI_GetFontSizeY();  _Label(s);  GUI_SetFont(pFont);  y = _GetYPos();  for (i = 0; i < 20000; i++) {    if (GUI_IsInFont(NULL, (U16)i)) {      GUI_GotoXY(ix * IncX, y);      if (ix++ > 20) {        ix = 0;        y += FontSizeY;      }    	GUI_DispChar((U16)i);    }  }  GUIDEMO_Delay(2000);  GUIDEMO_NotifyStartNext();}static void _ShowFonts(const char *s, const char *pMessage, const GUI_FONT **pPropFonts) {  int i;  _Label(s);  GUI_GotoXY(0, _GetYPos());  for (i=0;pPropFonts[i];i++) {    GUI_SetFont(pPropFonts[i]);    GUI_DispString(pMessage);    GUI_DispNextLine();  }  GUIDEMO_Wait();  GUIDEMO_NotifyStartNext();}static void _ShowChinaseSample(void) {  int i;  _Label("Chinase text\nmixed with\nASCIItext");  GUI_SetFont(&GUI_FontHZ16);  for (i=0;i<sizeof(_apSJIS)/sizeof(_apSJIS[0]);i++) {    GUI_DispStringHCenterAt(_apSJIS[i], LCD_GetXSize() / 2, _GetYPos() + 20);    GUI_DispNextLine();  }  GUIDEMO_Wait();  GUIDEMO_NotifyStartNext();}/***********************************************************************       GUIDEMO_ShowInternationalFonts************************************************************************/void GUIDEMO_ShowInternationalFonts(void) {  GUIDEMO_ShowIntro("International fonts",                    "uC/GUI supports UNICODE"                    "\n(all characters)and"                    "\nShift JIS (China)"                    );/* Show japanese text */  _ShowChinaseSample();/* Show some character sets */  _ShowCharacters("ASCII characters\n& European\nextensions", &GUI_Font13_1, 13);  _ShowCharacters("Hiragana &\nKatakana", &GUI_Font16_HK, 16);/* Show fonts */  _ShowFonts("Proportional\nFonts",              "FontConverter available to create your own fonts...",              _apPropFonts);  _ShowFonts("Monospaced\nFonts",              "Fonts with fixed character width...",              _apMonoFonts);  _ShowFonts("Digits",              "\n023-68790593",              _apDigitFonts);/* Show alignments */  GUIDEMO_NotifyStartNext();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -