FIX: CDC::CreatePointFont() May Create Wrong Size FontLast reviewed: September 19, 1997Article ID: Q145696 |
4.00
WINDOWS NT
kbprg kbfixlist kbbuglist kbcode
The information in this article applies to:
SYMPTOMSCalling CDC::CreatePointFont() results in a font that is not of the point size requested. This will occur when the y component of the DC's viewport origin is not at 0. A common place for this to occur would be in a CScrollView class where the user has scrolled the view vertically.
CAUSEMFC uses DPtoLP() to map the given device coordinates to logical coordinates. The case where the viewport origin is not at 0 is not taken into consideration by this code.
RESOLUTIONSet the y component of the viewport origin to 0 before calling CreatePointFont(). The following code demonstrates the workaround. Here pDC is a pointer to a CDC.
Sample Code
/* Compile options needed: default */POINT pt; SetViewportOrgEx(pDC->GetSafeHdc(), 0, 0, &pt); // set origin to 0,0 CreatePointFont(120, "Courier", pDC); SetViewportOrgEx(pDC->GetSafeHdc(), pt.x, pt,y, NULL); // restore origin
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.1.
|
Additional reference words: 4.10 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |