Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Change font type in WinCe Device
    text
    copied!<p>I am working on WinCE Device,working on GDI in that i am trying to change the font type, i have enabled the all font types in catalog items(Arial,Comic Sans MS,Courier New,Georgia,Tahoma,Times New Roman,Trebuchet MS,Veradana),i want to use that fonts but those are not working,device is working with default font only,</p> <p>The code i am using is given below...</p> <pre><code>void CreateText () { // First, clear all fields. memset (&amp;logfont, 0, sizeof (logfont)); // Create a GDI Times New Roman font. logfont.lfHeight = 20; logfont.lfWidth = 0; logfont.lfEscapement = 0; logfont.lfOrientation = 0; logfont.lfWeight = FW_BOLD; logfont.lfItalic = TRUE;//FALSE; logfont.lfUnderline = FALSE; logfont.lfStrikeOut = FALSE; logfont.lfCharSet = DEFAULT_CHARSET; logfont.lfOutPrecision = OUT_DEFAULT_PRECIS; logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; logfont.lfQuality = DEFAULT_QUALITY; logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; _tcsncpy (logfont.lfFaceName, TEXT("Arial"), LF_FACESIZE); //Comic Sans MS logfont.lfFaceName[LF_FACESIZE-1] = TEXT('\0'); // Ensure null termination hfontTimes = CreateFontIndirect (&amp;logfont); //CreatePointFontIndirect(&amp;logfont); if (!hfontTimes) { // CreateFontIndirect failed. Insert code here for error // handling. printf("\n CreateFontIndirect failed... "); } //SendMessage(NULL,WM_SETREDRAW,(WPARAM)TRUE,NULL); } void initiateText () { // Get a GDI DC onto the backbuffer, where you will render the text. hdcSurface = GetDC (NULL); // Select the font into the DC. hfontSave = (HFONT) SelectObject (hdcSurface, hfontTimes); // Set the background mode to transparent, so there is no // rectangle behind the text. SetBkMode (hdcSurface, TRANSPARENT); } void printText (HDC hdcSurface, int screen_x, int screen_y, LPTSTR lpszText, COLORREF color) { int bReturn; // Set text color. SetTextColor (hdcSurface, color); bReturn = ExtTextOut (hdcSurface, screen_x, screen_y, 0, // No flags set NULL, // No clipping rectangle lpszText, // String to display lstrlen (lpszText), // Number of characters NULL); // Use default spacing. } </code></pre> <p>as explained above selected font is not displaying on screen,looking for your suggestions.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload