Jeremiah Flerchinger <jeremiah.flerchinger(a)gmail.com> writes:
else { - FIXME("Write %c at (%i,%i) - not yet supported in graphic modes.\n", (char)ascii, x, y); + dat = vga_fb_window_data; + /* get attribute values */ + fgColor = attr & 0x0F; + bgColor = (attr & 0x70)>>4; + /* Create DC to draw font on */ + hDC = CreateCompatibleDC(NULL); + if (hDC == 0) + { + ERR("CreateCompatibleDC FAILED. \n"); + } + /* Create bitmap to draw font on + * define bitmap info {size, width, height, planes, bits, compression, sizeimage} + * origin defaults to top left. negative height makes origin at bottom left. + */ + hTempBmp = CreateDIBSection( hDC, &bmi, DIB_RGB_COLORS, (void**)&pSrcData, NULL, 0 ); + if (hTempBmp == NULL) + { + ERR("CreateDIBSection FAILED. \n"); + }
You should actually handle the errors, not just print an ERR and go on using invalid data.
+ /* get a font compatable to old IBM ROM (IBM extended character set) */ + IBM_hFont = (HFONT) GetStockObject( OEM_FIXED_FONT ); + GetObjectA ( IBM_hFont, sizeof(LOGFONTA), & IBM_lFont ); + /* scale character & set attributes - FIXME tweak or make better font for smaller sizes */ + IBM_lFont.lfWidth = ModeInfo->CharWidth; + IBM_lFont.lfHeight = ModeInfo->CharHeight; + /* create new font with desired properties */ + ModIBM_hFont = CreateFontIndirectA ( & IBM_lFont ); + if (ModIBM_hFont == NULL) + { + ERR("CreateFontIndirectA FAILED. \n"); + } + SelectObject(hDC, hTempBmp); + SelectObject(hDC, ModIBM_hFont); + SetTextColor(hDC, fgColor<<16); /* set text color 0x00bbggrr */ + SetBkColor(hDC, bgColor<<16); /* set text color 0x00bbggrr */ + /* define where char is drawn on bitmap */ + rect.left = 0; + rect.top = 0; + rect.bottom = ModeInfo->CharHeight-1; + rect.right = ModeInfo->CharWidth-1; + /* draw char onto temporary bitmap */ + DrawTextHeight = DrawTextA(hDC, (char *)&ascii, 1, &rect, DT_LEFT); + if (DrawTextHeight == 0) + { + ERR("DrawTextA FAILED. \n"); + } + /* translate from TextRow & TextCol to PixelRow & PixelCol */ + x = x * ModeInfo->CharWidth; + y = y * ModeInfo->CharHeight; + /* translate & copy char into display buffer */ + for (ih = 0; ih < ModeInfo->CharHeight; ih = ih+1)
Please cut down on the number of comments, there's no need to explain what each line of code is doing, that's adding more noise than information. -- Alexandre Julliard julliard(a)winehq.org