?
Solved

Drawing Vertical Text ?

Posted on 2002-03-27
2
Medium Priority
?
440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Fraction earned 40 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

771 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