FAQ TBarCode DLL / TBarCode Library
Comment générer une sortie bitmap avec un rendu de police anticrénelé ?
Comment générer une sortie bitmap avec un rendu de police anticrénelé ?
Ajuster le DC approprié
Utilisez le DC d'écran suivant pour créer un rendu de police avec des options d'anticrénelage (tel qu'ajusté pour l'écran) :
HDC dc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
eCode = BCSaveImageEx(m_pbarCode, dc, file, imageType, 100, widthPx, heightPx, dpi, dpi );
if (dc)
DeleteDC(dc);
Ajuster la police appropriée (LOGFONT)
Utilisez la boîte de dialogue de police standard de Windows ou la fonction suivante pour récupérer une structure LOGFONT préinitialisée depuis le GDI Windows :
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);