在skindemo.c中並沒有普通標簽的使用方法,花了點時間研究出來了,關鍵是皮膚界面結構體裡面的字體成員fonts的賦值,關鍵代碼如下:
static si_nrmlabel_t title ={"Hello", 0xDD0000, 0x00FF00, 0xFF0000, 0};
static skin_item_t skin_main_items [] =
{
{SIID_TITLE, SI_TYPE_NRMLABEL | SI_TEST_SHAPE_RECT |SI_STATUS_VISIBLE,
15, 0, {}, -1, "Title", 0, &title},
};
/* 字節資源裝/卸載函數 */
void load_skin_fonts (skin_head_t *skin, BOOL load)
{
int font_num = 2;
LOGFONT *my_logfont;
if (load)
{
skin->fonts = (LOGFONT* ) calloc (font_num, sizeof(LOGFONT));
my_logfont = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 12, 0);
memcpy((void *)&skin->fonts[0], (void *)my_logfont, sizeof(LOGFONT));
DestroyLogFont(my_logfont);/* 釋放字體 */
my_logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
memcpy((void *)&skin->fonts[1], (void *)my_logfont, sizeof(LOGFONT));
DestroyLogFont(my_logfont);/* 釋放字體 */
}
else
{
free ((void *)skin->fonts);
}
}
然後再主函數中調用,完成卸載即可.