¿Cómo puedo generar una salida en mapa de bits con renderizado de fuente suavizado (anti-aliasing)?
Ajustar el DC adecuado
Use el siguiente DC de pantalla para crear el renderizado de fuente con opciones de suavizado (según lo ajustado para la pantalla):
HDC dc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
eCode = BCSaveImageEx(m_pbarCode, dc, file, imageType, 100, widthPx, heightPx, dpi, dpi );
if (dc)
DeleteDC(dc);
Ajustar la fuente adecuada (LOGFONT)
Use el diálogo de fuentes estándar de Windows o la siguiente función para obtener una estructura LOGFONT preinicializada desde 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);