0. You need a font data contains GB2312 font.
Please note that Nuvoton emWin feature does not come with any fonts or a permission or license to use any PC installed font for converting purposes. It is user’s sole responsibility to not infringe upon any third party intellectual property right by making use of the fonts in its application and obtain a license if required by the legal owner of the font.
1. Download the latest N9H20 BSP https://github.com/OpenNuvoton/N9H20_emWin_NonOS version v6.10f.6.
How to check version? Please refer to the link https://github.com/OpenNuvoton/N9H20_em ... _Version.h
Code: Select all
#define GUI_VERSION 610066
Code: Select all
//
// Init emWin
//
GUI_Init();
//
// Enable GB2312
//
NVT_GUI_GB_SetEncodeGB2312();
Code: Select all
//
// _acFontDataArray is your font data in c array
// _u32AsciiFontDataOffset means the first ASCII font data offset, e. g., 0x00000000
//
NVT_GUI_SetASCIIOffset((U32)_acFontDataArray, _u32AsciiFontDataOffset);
Code: Select all
//
// _acFontDataArray is your font data in c array
// _u32Gb2312FontDataOffset means the first GB2312 font data offset, e. g., 0x00000800
//
NVT_GUI_SetGB2312Offset((U32)_acFontDataArray, _u32Gb2312FontDataOffset);
Code: Select all
unsigned char _acFontDataArray[8888UL + 1] = {
0x00, 0x00, ...
}
Code: Select all
//
// GUI_MyFont is a user defined font that utilizes emWin font structure
//
GUI_SetFont(&GUI_MyFont);
Code: Select all
GUI_CONST_STORAGE GUI_FONT GUI_MyFont = {
GUI_FONTTYPE_PROP,
...
}
//
// Please note that it supports "GUI_FONTTYPE_PROP" ONLY!
//
Code: Select all
//
// If your IDE & compiler support GB2312 font encoding:
//
GUI_DispString("啊\n");
//
// Or utilize hex code:
// The first byte 0xb0 is "区码" & the second byte 0xa1 is "位码"
// 0xb0, 0xa1 equals 啊
//
GUI_DispString("\xb0\xa1\n");
//
// Another example:
//
GUI_DispString("Hello! World~\xb0\xa1""GB2312 test OK!\n");