BUG: Print Preview Doesn't Honor Font Width SettingLast reviewed: September 3, 1997Article ID: Q173249 |
The information in this article applies to:
SYMPTOMSMFC has a Print Preview feature that shows you on the screen what your document should look like when it is printed. However, if you use a font with a non-zero width in your OnDraw routine to make the text appear "condensed" or "squished", then the preview MFC shows you on the screen does not appear as the document will look when it is actually printed.
CAUSEA bug in the MFC CPreviewDC::MirrorFont forces a zero value for the font width which causes a normal-looking font to be used in the Print Preview.
RESOLUTIONInsert an exact copy of the MFC function into one of your project source files and make the needed corrections. A linker option override will force it to use your corrected version of the function and ignore MFC's function.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
void CFntWidthView::OnDraw(CDC* pDC) { pDC->SetMapMode(MM_LOENGLISH); LOGFONT lfFont; CFont fontNew, *fontOld; ZeroMemory(&lfFont, sizeof(lfFont)); lstrcpy(lfFont.lfFaceName, "Arial"); lfFont.lfWidth = 10; lfFont.lfHeight = 50; fontNew.CreateFontIndirect(&lfFont); fontOld = pDC->SelectObject(&fontNew); pDC->TextOut(0, -100, "Font Width lfWidth = 10.", 24); pDC->SelectObject(fontOld); } Steps to WorkaroundYou can work around the problem only for projects statically linked to MFC. The workaround uses the linker /FORCE:MULTIPLE option to override MFC's version of CPreviewDC::MirrorFont with your corrected version. Follow the steps below to work around this problem:
For dynamically linked projects, there are no good workarounds other than avoiding custom-width fonts. Keywords : MfcDocView MfcUI vcbuglist400 vcbuglist500 Technology : kbMfc Version : WINDOWS NT:2.0,2.1,2.2,4.0,4.1,4.2,5.0 Platform : NT WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |