EDN Admin
Well-known member
I have following code in my application (in OnPaint() of a dialog):
<pre class="prettyprint CPaintDC dc(this); // device context for painting
dc.SetGraphicsMode(GM_ADVANCED);
dc.SetMapMode( MM_ANISOTROPIC );
dc.SetWindowExt( 1000, 1000 );
dc.SetViewportExt( 96, 96 );
LOGFONT lf;
lf.lfHeight = 166;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 900;
//lf.lfOrientation = 0;// Orientation 0 works OK, 900 and 2700 makes characters overlapping
lf.lfWeight = 400;
lf.lfItalic = 0;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
lf.lfCharSet = 1;
lf.lfOutPrecision = 0;
lf.lfClipPrecision = 0;
lf.lfQuality = 2;
lf.lfPitchAndFamily = 0;
strcpy(lf.lfFaceName, "Arial" ) ;
//strcpy(lf.lfFaceName, "MS Sans Serif" ) ; // This Works OK
CFont *Object = new CFont;
//
// Create the font, using the LogFont...
//
VERIFY(Object->CreateFontIndirect(&lf) == TRUE);
CFont *OldFont = dc.SelectObject( Object );
UINT Flags = DT_LEFT |DT_NOPREFIX| DT_NOCLIP | DT_WORDBREAK;
CString strToDraw = "Test String";
CRect r(200,200,8000,1200);
dc.DrawText(strToDraw, -1, &r, Flags);
[/code]
The string is drawn correctly if the orientation is 0. But if the orientation is set to 900 (0r 2700), the characters start overlapping.<br/>
The problem is seen on Windows 7 only. It works OK with Windows XP. Some of the fonts (e.g. MS Sans Serif) work OK on both Win7 and Win XP.
Is there any specific reason for the difference? Is there any way we can get results similar to Win XP in Win 7 with orientation set to 900?
Any Help is highly appreciated.
Thanks,
Krushna
View the full article
<pre class="prettyprint CPaintDC dc(this); // device context for painting
dc.SetGraphicsMode(GM_ADVANCED);
dc.SetMapMode( MM_ANISOTROPIC );
dc.SetWindowExt( 1000, 1000 );
dc.SetViewportExt( 96, 96 );
LOGFONT lf;
lf.lfHeight = 166;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 900;
//lf.lfOrientation = 0;// Orientation 0 works OK, 900 and 2700 makes characters overlapping
lf.lfWeight = 400;
lf.lfItalic = 0;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
lf.lfCharSet = 1;
lf.lfOutPrecision = 0;
lf.lfClipPrecision = 0;
lf.lfQuality = 2;
lf.lfPitchAndFamily = 0;
strcpy(lf.lfFaceName, "Arial" ) ;
//strcpy(lf.lfFaceName, "MS Sans Serif" ) ; // This Works OK
CFont *Object = new CFont;
//
// Create the font, using the LogFont...
//
VERIFY(Object->CreateFontIndirect(&lf) == TRUE);
CFont *OldFont = dc.SelectObject( Object );
UINT Flags = DT_LEFT |DT_NOPREFIX| DT_NOCLIP | DT_WORDBREAK;
CString strToDraw = "Test String";
CRect r(200,200,8000,1200);
dc.DrawText(strToDraw, -1, &r, Flags);
[/code]
The string is drawn correctly if the orientation is 0. But if the orientation is set to 900 (0r 2700), the characters start overlapping.<br/>
The problem is seen on Windows 7 only. It works OK with Windows XP. Some of the fonts (e.g. MS Sans Serif) work OK on both Win7 and Win XP.
Is there any specific reason for the difference? Is there any way we can get results similar to Win XP in Win 7 with orientation set to 900?
Any Help is highly appreciated.
Thanks,
Krushna
View the full article