#include "main.h" #include "SaveToTXT.h" bool SaveRenderedGlyphToTXT(FT_Bitmap& bmp, LPCTSTR file) { FILE* fp = _tfopen(file,_T("wt")); if (!fp) return false; _ftprintf(fp,_T("rows=%d\nwidth=%d\npitch=%d\nnum_grays=%d\npixel_mode=%d\npalette_mode=%d\n\n"), bmp.rows,bmp.width,bmp.pitch,bmp.num_grays,bmp.pixel_mode,bmp.palette_mode); unsigned char* bufferPos = bmp.buffer; for (int row = 0; row < bmp.rows; row++) { for (int col = 0; col < bmp.width; col++) { if (col > 0) _ftprintf(fp,_T(" ")); _ftprintf(fp,_T("%02X"),bufferPos[col]); } _ftprintf(fp,_T("\n")); bufferPos += bmp.pitch; } fflush(fp); fclose(fp); return true; }