Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drawing Vertical Text ?

Posted on 2002-03-27
2
Medium Priority
?
441 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 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