FAQ TBarCode DLL / TBarCode Library
How Can I Generate a Bitmap Output with Anti-Aliased Font Rendering?
How Can I Generate a Bitmap Output with Anti-Aliased Font Rendering?
Adjust the Proper DC
Use the following screen DC to create font rendering with anti-aliasing options (as adjusted for the Screen):
HDC dc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
eCode = BCSaveImageEx(m_pbarCode, dc, file, imageType, 100, widthPx, heightPx, dpi, dpi );
if (dc)
DeleteDC(dc);
Adjust the Proper Font (LOGFONT)
Use the Windows standard font dialog or the following function to retrieve a pre-initialized LOGFONT structure from Windows GDI:
HFONT hSystemVariableFont = (HFONT ) GetStockObject( ANSI_VAR_FONT ); LOGFONT lfSystemVariableFont; GetObject ( hSystemVariableFont, sizeof(LOGFONT), &lfSystemVariableFont ); // Make sure that the following flags are set in the LOGFONT structure passed to BCSetLogFont(): lfOutPrecision (e.g. set to 3) lfClipPrecision (e.g. set to 2) lfQuality (e.g. set to 1) lfWeight (e.g. set to 400) lfFaceName should be set to a True Type font (e.g. “Arial”) // Calculate the font height as follows: lfHeight = = -MulDiv( 10 /*PointSize*/, GetDeviceCaps(hDC, LOGPIXELSY), 72);