yaronkl
February 7th, 2002, 11:37 AM
Hello,
I am trying to print to the laser printer in non-proportional font. i.e., if i print a line of ZZZZZ and below it a line of ....., they should have the same widht.
i've tried different fonts (Courier, FixedSys) and different sizes, but it always seems to print them proportional, i.e. Z is wider than I .
Can anyone advise please ? I am using the following code:
int CPrinterLaser::ChangeFontStyle(WWP_PRN_INFO *lpInfo,LPCSTR lpFontName, int iStyle, int iWidthFactor, int iHeightFactor)
{
LOGFONT lf;
HGDIOBJ hGDI;
HFONT hFont;
hGDI = GetCurrentObject(m_hDC, OBJ_FONT);
if ( !hGDI )
return wwprnFailedGdiHandle;
if ( !GetObject(hGDI, sizeof(lf), &lf) )
return wwprnFailedFontData;
if (lpFontName)
{
strcpy(lf.lfFaceName,lpFontName);
hFont = CreateFontIndirect(&lf);
SelectObject(m_hDC, hFont);
hGDI = GetCurrentObject(m_hDC, OBJ_FONT);
if ( !GetObject(hGDI, sizeof(lf), &lf) )
return wwprnFailedFontData;
}
if (iWidthFactor > -1) lf.lfWidth = iWidthFactor;
if (iHeightFactor > -1) lf.lfHeight = iHeightFactor;
if (iStyle > -1 ) lf.lfWeight = iStyle;
hFont = CreateFontIndirect(&lf);
SelectObject(m_hDC, hFont);
//pCurFont = GetCurrentFont(m_hDC);
return wwprnOk;
}
I am trying to print to the laser printer in non-proportional font. i.e., if i print a line of ZZZZZ and below it a line of ....., they should have the same widht.
i've tried different fonts (Courier, FixedSys) and different sizes, but it always seems to print them proportional, i.e. Z is wider than I .
Can anyone advise please ? I am using the following code:
int CPrinterLaser::ChangeFontStyle(WWP_PRN_INFO *lpInfo,LPCSTR lpFontName, int iStyle, int iWidthFactor, int iHeightFactor)
{
LOGFONT lf;
HGDIOBJ hGDI;
HFONT hFont;
hGDI = GetCurrentObject(m_hDC, OBJ_FONT);
if ( !hGDI )
return wwprnFailedGdiHandle;
if ( !GetObject(hGDI, sizeof(lf), &lf) )
return wwprnFailedFontData;
if (lpFontName)
{
strcpy(lf.lfFaceName,lpFontName);
hFont = CreateFontIndirect(&lf);
SelectObject(m_hDC, hFont);
hGDI = GetCurrentObject(m_hDC, OBJ_FONT);
if ( !GetObject(hGDI, sizeof(lf), &lf) )
return wwprnFailedFontData;
}
if (iWidthFactor > -1) lf.lfWidth = iWidthFactor;
if (iHeightFactor > -1) lf.lfHeight = iHeightFactor;
if (iStyle > -1 ) lf.lfWeight = iStyle;
hFont = CreateFontIndirect(&lf);
SelectObject(m_hDC, hFont);
//pCurFont = GetCurrentFont(m_hDC);
return wwprnOk;
}