Solved

Drawing Vertical Text ?

Posted on 2002-03-27
2
433 Views
Last Modified: 2010-05-18
Hi, I need to draw text vertically, ....(simple enuf)

But the font that needs to be drawn, needs to be selected by the user at runtime.

(* This is an extract of my code *)
GetObject(Canvas.Font.Handle, SizeOf(LogFont), @LogFont);
 with LogFont do
 begin
   lfEscapement:= 90 * 10; //this does the rotation
   lfQuality := PROOF_QUALITY;
   lfFaceName:= 'Comic Sans MS';
/* The problem is with the above line, as it needs to be set at runtime */
 end;

 //Assign the new rotated font handle
 NewFont := CreateFontIndirect(LogFont);
 OldFont := SelectObject(Canvas.Handle,NewFont);

 ACanvas.TextOut(0,0, 'Testing...');

 //restore old font and delete new handle
 NewFont := SelectObject(Canvas.Handle,OldFont);
 DeleteObject(NewFont);

(********** END **************)
What I am doing instead of that line is

   S:=Canvas.Font.Name; // string  
// Assume Canvas.Font is some font set by the user at runtime...
   FillChar(lfFaceName,32,#0);
   For j := 1 to Length(S) do
     lfFaceName[j-1]:= S[j]; // For this example assume the user has chosen Comic Sans MS...

Even though the above code is the equivalent to
     lfFaceName[j-1]:= 'Comic Sans MS';

... I only get the correct font displayed if it is hardcoded..????

Help.....???
0
Comment
Question by:CyberKnight
2 Comments
 
LVL 1

Accepted Solution

by:
Fraction earned 10 total points
ID: 6899084
You have probably tested, but doesn't it work with:
StrCopy(lfFaceName, PChar(s));
0
 

Author Comment

by:CyberKnight
ID: 6899277
Wow, Yes, it does work, that was something I didnt test with....(duh !)

Thank you... Great !!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now