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

📄 guidemo_font.c

📁 UCOSII在STM32平台的移植
💻 C
📖 第 1 页 / 共 2 页
字号:
   {   8,   8,  1, (void*) &_acFontSJIS16_0065 } /* code 0065 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_006C } /* code 006C */,
   {   8,   8,  1, (void*) &_acFontSJIS16_006E } /* code 006E */,
   {   8,   8,  1, (void*) &_acFontSJIS16_006F } /* code 006F */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0072 } /* code 0072 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0073 } /* code 0073 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0075 } /* code 0075 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0077 } /* code 0077 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0078 } /* code 0078 */,
   {   8,   8,  1, (void*) &_acFontSJIS16_0079 } /* code 0079 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8140 } /* code 8140 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8148 } /* code 8148 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82A8 } /* code 82A8 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82A9 } /* code 82A9 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82B1 } /* code 82B1 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82B3 } /* code 82B3 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82B7 } /* code 82B7 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82BF } /* code 82BF */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82C5 } /* code 82C5 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82C9 } /* code 82C9 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82CD } /* code 82CD */,
   {  16,  16,  2, (void*) &_acFontSJIS16_82F1 } /* code 82F1 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_834E } /* code 834E */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8358 } /* code 8358 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8362 } /* code 8362 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8389 } /* code 8389 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8B43 } /* code 8B43 */,
   {  16,  16,  2, (void*) &_acFontSJIS16_8CB3 } /* code 8CB3 */
};

static const GUI_FONT_PROP _FontSJIS16_Prop29 =
{
   0x8CB3 /* first character */, 0x8CB3 /* last character  */,
   & _FontSJIS16_CharInfo[33] /* address of first character */,
   (void*) 0 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop28 =
{
   0x8B43 /* first character */, 0x8B43 /* last character  */,
   & _FontSJIS16_CharInfo[32] /* address of first character */,
   (void*) &_FontSJIS16_Prop29 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop27 =
{
   0x8389 /* first character */, 0x8389 /* last character  */,
   & _FontSJIS16_CharInfo[31] /* address of first character */,
   (void*) &_FontSJIS16_Prop28 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop26 =
{
   0x8362 /* first character */, 0x8362 /* last character  */,
   & _FontSJIS16_CharInfo[30] /* address of first character */,
   (void*) &_FontSJIS16_Prop27 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop25 =
{
   0x8358 /* first character */, 0x8358 /* last character  */,
   & _FontSJIS16_CharInfo[29] /* address of first character */,
   (void*) &_FontSJIS16_Prop26 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop24 =
{
   0x834E /* first character */, 0x834E /* last character  */,
   & _FontSJIS16_CharInfo[28] /* address of first character */,
   (void*) &_FontSJIS16_Prop25 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop23 =
{
   0x82F1 /* first character */, 0x82F1 /* last character  */,
   & _FontSJIS16_CharInfo[27] /* address of first character */,
   (void*) &_FontSJIS16_Prop24 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop22 =
{
   0x82CD /* first character */, 0x82CD /* last character  */,
   & _FontSJIS16_CharInfo[26] /* address of first character */,
   (void*) &_FontSJIS16_Prop23 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop21 =
{
   0x82C9 /* first character */, 0x82C9 /* last character  */,
   & _FontSJIS16_CharInfo[25] /* address of first character */,
   (void*) &_FontSJIS16_Prop22 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop20 =
{
   0x82C5 /* first character */, 0x82C5 /* last character  */,
   & _FontSJIS16_CharInfo[24] /* address of first character */,
   (void*) &_FontSJIS16_Prop21 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop19 =
{
   0x82BF /* first character */, 0x82BF /* last character  */,
   & _FontSJIS16_CharInfo[23] /* address of first character */,
   (void*) &_FontSJIS16_Prop20 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop18 =
{
   0x82B7 /* first character */, 0x82B7 /* last character  */,
   & _FontSJIS16_CharInfo[22] /* address of first character */,
   (void*) &_FontSJIS16_Prop19 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop17 =
{
   0x82B3 /* first character */, 0x82B3 /* last character  */,
   & _FontSJIS16_CharInfo[21] /* address of first character */,
   (void*) &_FontSJIS16_Prop18 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop16 =
{
   0x82B1 /* first character */, 0x82B1 /* last character  */,
   & _FontSJIS16_CharInfo[20] /* address of first character */,
   (void*) &_FontSJIS16_Prop17 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop15 =
{
   0x82A8 /* first character */, 0x82A9 /* last character  */,
   & _FontSJIS16_CharInfo[18] /* address of first character */,
   (void*) &_FontSJIS16_Prop16 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop14 =
{
   0x8148 /* first character */, 0x8148 /* last character  */,
   & _FontSJIS16_CharInfo[17] /* address of first character */,
   (void*) &_FontSJIS16_Prop15 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop13 =
{
   0x8140 /* first character */, 0x8140 /* last character  */,
   & _FontSJIS16_CharInfo[16] /* address of first character */,
   (void*) &_FontSJIS16_Prop14 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop12 =
{
   0x0077 /* first character */, 0x0079 /* last character  */,
   & _FontSJIS16_CharInfo[13] /* address of first character */,
   (void*) &_FontSJIS16_Prop13 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop11 =
{
   0x0075 /* first character */, 0x0075 /* last character  */,
   & _FontSJIS16_CharInfo[12] /* address of first character */,
   (void*) &_FontSJIS16_Prop12 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop10 =
{
   0x0072 /* first character */, 0x0073 /* last character  */,
   & _FontSJIS16_CharInfo[10] /* address of first character */,
   (void*) &_FontSJIS16_Prop11 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop9 =
{
   0x006E /* first character */, 0x006F /* last character  */,
   & _FontSJIS16_CharInfo[8] /* address of first character */,
   (void*) &_FontSJIS16_Prop10 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop8 =
{
   0x006C /* first character */, 0x006C /* last character  */,
   & _FontSJIS16_CharInfo[7] /* address of first character */,
   (void*) &_FontSJIS16_Prop9 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop7 =
{
   0x0065 /* first character */, 0x0065 /* last character  */,
   & _FontSJIS16_CharInfo[6] /* address of first character */,
   (void*) &_FontSJIS16_Prop8 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop6 =
{
   0x0061 /* first character */, 0x0061 /* last character  */,
   & _FontSJIS16_CharInfo[5] /* address of first character */,
   (void*) &_FontSJIS16_Prop7 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop5 =
{
   0x004C /* first character */, 0x004C /* last character  */,
   & _FontSJIS16_CharInfo[4] /* address of first character */,
   (void*) &_FontSJIS16_Prop6 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop4 =
{
   0x0048 /* first character */, 0x0048 /* last character  */,
   & _FontSJIS16_CharInfo[3] /* address of first character */,
   (void*) &_FontSJIS16_Prop5 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop3 =
{
   0x003F /* first character */, 0x003F /* last character  */,
   & _FontSJIS16_CharInfo[2] /* address of first character */,
   (void*) &_FontSJIS16_Prop4 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop2 =
{
   0x002D /* first character */, 0x002D /* last character  */,
   & _FontSJIS16_CharInfo[1] /* address of first character */,
   (void*) &_FontSJIS16_Prop3 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT_PROP _FontSJIS16_Prop1 =
{
   0x0020 /* first character */, 0x0020 /* last character  */,
   & _FontSJIS16_CharInfo[0] /* address of first character */,
   (void*) &_FontSJIS16_Prop2 /* pointer to next GUI_FONT_PROP */
};

static const GUI_FONT _FontSJIS16 =
{
   GUI_FONTTYPE_PROP_SJIS /* type of font    */, 16 /* height of font  */,
   16 /* space of font y */, 1 /* magnification x */, 1 /* magnification y */,
   (void*) &_FontSJIS16_Prop1
};

/*********************************************************************
*
*       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[] =
{
   {"\x82\xa8\x8c\xb3\x8b\x43\x82\xc5\x82\xb7\x82\xa9\x81\x48\nHow are you?\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 _ShowJapaneseSample(void)
{
   int i;
   _Label("Japanese text\nmixed with\nASCIItext");
   GUI_SetFont(&_FontSJIS16);
   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 (Japan)");
   /* Show japanese text */
   _ShowJapaneseSample();
   /* 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", "\n+- 0.1234", _apDigitFonts);
   /* Show alignments */
   GUIDEMO_NotifyStartNext();
}

⌨️ 快捷键说明

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