Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing vertical text

Status
Not open for further replies.

philrosenberg

Technical User
Dec 3, 2003
15
GB
I'm having a bit of trouble drawing text on a window. I am trying to get the text vertical so I'm getting the LOGFONT from the default font, spinning it 900 tenths of a degree then creationg a new font with this LOGFONT, selecting it with the DC and then using TextOut to output the text. However the text still appears horizontally. My code is below

CFont vertFont;
LOGFONT lf;
pDC->GetCurrentFont()->GetLogFont(&lf);
lf.lfOrientation=900;
vertFont.CreateFontIndirect(&lf);
pDC->SelectObject(&vertFont);
pDC->TextOut(-50, 300, "Vertical Text");

if anyone can spot what I'm doing wrong I'd be very grateful

Phil
 
This only works with TrueType fonts. What font are you using?
 
thanks teriveret for the reply. After much searching through various forums I found this out. I was using the system font I have now changed to arial and it works. For anyone who views this thread later this is done by adding the line

strcpy(lf.lfFaceName,"Arial");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top