?? guidemo_font.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 + -