Dear,
This is my label create call back function. I am using ttf font create library.
Mp problem is whenever label changed , again and again calling GUI_TTF_CreateFont(&Font, &Cs); function.
it creates function every changed. So it will takes time.
I want to create it at startup once.
Display All
This is my label create call back function. I am using ttf font create library.
Mp problem is whenever label changed , again and again calling GUI_TTF_CreateFont(&Font, &Cs); function.
it creates function every changed. So it will takes time.
I want to create it at startup once.
Source Code
- void _cbChildLabel(WM_MESSAGE * pMsg) {
- GUI_TTF_DATA TTF;
- GUI_TTF_CS Cs;
- GUI_FONT Font;
- char caption[15];
- GUI_BITMAP pImage_565;
- int id = pMsg->hWin;
- U8 * pData;
- int cSn = 0;
- switch (pMsg->MsgId) {
- case WM_PAINT:
- if( 1 )
- {
- GUI_SetColor(GUI_RED);
- TTF.NumBytes = sizeof(rawData_roboto);
- TTF.pData = rawData_roboto;
- Cs.FaceIndex = 0;
- Cs.pTTF = &TTF;
- Cs.PixelHeight = 12;
- // Create the font by pointing to a font struct and the CS struct
- //
- GUI_TTF_CreateFont(&Font, &Cs);
- //
- // Set the newly created font as the current font
- //
- GUI_SetFont(&Font);
- //#endif
- GUI_SetTextMode(GUI_TM_TRANS);
- GUI_DispStringAt((char *)"Test", 0, 0);
- GUI_TTF_DestroyCache();
- break;
- // case WM_PID_STATE_CHANGED:
- // break;
- default:
- WM_DefaultProc(pMsg);
- }
- }