I'm working on a MFC project with some GDI drawings.
I use DC.DrawText
to draw a vertical text into a DC
using a LOGFONT
with lfEscapement = 900
.
The text is output when i use DT_NOCLIP
in the desired vertical formatting.
However to center this text i used a call to DC.DrawText
with the DT_CALCRECT
argument.
I recognized that, despite the text is indeed drawn vertically, the CRect
has a larger width
than height.
My intuition says me that a vertical drawn text should have a larger height than width.
I did not include the calculation for centering the text. The question is just about what i can rely upon when i implement that vertical centering.
Does DC.DrawText
with DT_CALCRECT
ignore escapement?
void CMFCFontTestDlg::OnPaint()
{
CPaintDC dc(this); // Gerätekontext zum Zeichnen
if (IsIconic())
{
...
}
else
{
CDialogEx::OnPaint();
CRect clTextRect;
CFont myFont;
myFont.CreateFont(12, 0, 900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Tahoma"));
CFont* oldFont = dc.SelectObject(&myFont);
dc.DrawText(_T("000000"), clTextRect, DT_CALCRECT);
clTextRect.MoveToXY(100, 100);
dc.DrawText(_T("000000"), clTextRect, DT_NOCLIP);
dc.SelectObject(oldFont);
}
}