FAQ TBarCode DLL / TBarCode Library
Come posso generare un output bitmap con rendering font anti-aliasing?
Come posso generare un output bitmap con rendering font anti-aliasing?
Regolare il DC corretto
Utilizzate il seguente DC schermo per creare il rendering font con opzioni anti-aliasing (regolato come per lo schermo):
HDC dc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
eCode = BCSaveImageEx(m_pbarCode, dc, file, imageType, 100, widthPx, heightPx, dpi, dpi );
if (dc)
DeleteDC(dc);
Regolare il font corretto (LOGFONT)
Utilizzate la finestra di dialogo font standard di Windows oppure la seguente funzione per recuperare una struttura LOGFONT pre-inizializzata da 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);