diff -r e8c05ae7f418 -r 631f53604811 test.cpp --- a/test.cpp Wed May 21 09:03:40 2014 +0200 +++ b/test.cpp Wed May 21 10:19:22 2014 +0200 @@ -52,7 +52,8 @@ MainWindow::MainWindow(FXApp *app) : FXMainWindow(app, "HIDAPI Test Application", NULL, NULL, DECOR_ALL, 200,100, 600,900), - iCurrentFont(NULL) + iCurrentFont(NULL), + iFontImage(NULL) { iDimming=0x35; devices = NULL; @@ -178,6 +179,9 @@ delete iCurrentFont; iCurrentFont = NULL; + delete iFontImage; + iFontImage = NULL; + if (connected_device) hid_close(connected_device); hid_exit(); @@ -750,6 +754,35 @@ delete iCurrentFont; iCurrentFont = NULL; iCurrentFont = new FXFont(getApp(),iCurrentFontDesc); + iCurrentFont->create(); + // + delete iFontImage; + iFontImage = NULL; + // + FXString text="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-[]{}();%$£&~#|_"; + //Create an image the proper size for our text + iFontImage = new FXTGAImage(getApp(),NULL,IMAGE_SHMI|IMAGE_SHMP,iCurrentFont->getTextWidth(text),iCurrentFont->getFontHeight()); + iFontImage->create(); + //Perform our drawing + { + FXDCWindow dc(iFontImage); + //dc.begin(iFontImage); + dc.setFont(iCurrentFont); + dc.setForeground(0xFFFFFFFF); + //dc.setBackground(0xFF000000); + //dc.setFillStyle(FILL_SOLID); + dc.fillRectangle(0,0,iFontImage->getWidth(),iFontImage->getHeight()); + dc.setForeground(0xFF000000); + dc.drawText(0,iCurrentFont->getFontAscent(),text); + //dc.end(); + } + FXFileStream file; + file.open("fonttest.tga",FXStreamSave); + iFontImage->restore(); + iFontImage->savePixels(file); + file.close(); + + // }