#1 2014-06-07 14:48:45

Lesh11
Member
Registered: 2014-06-07
Posts: 3

Rotated text / logfont

All,
I am totally lost.  Could I please get some sample code for rotating text.  If I could figure out how to use a logfont I could go from there.

Thanks,
Les

Offline

#2 2014-06-07 15:15:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: Rotated text / logfont

Just rotate text properties when adding it in the TMetaFileCanvas, at GDI commands level.

See e.g. http://delphi.about.com/cs/adptips1999/ … 0999_2.htm

Offline

#3 2014-06-07 17:23:56

Lesh11
Member
Registered: 2014-06-07
Posts: 3

Re: Rotated text / logfont

I am still failing at assigning the font. I am trying:

   
var
lPdf   : TPdfDocumentGDI;
lPage  : TPdfPage;
LogFont         :TLogFont;
tf      :tFont;

begin
     lPdf := TPdfDocumentGDI.Create;
     lPage := lPDF.AddPage;
{

otherworking code here

}
     tf := tFont.Create;
     tf.Assign(Form1.Canvas.Font) ;
     GetObject(tf.Handle, sizeof(LogFont), @LogFont) ;
     LogFont.lfEscapement   := 315 * 10;
     LogFont.lfOrientation  := 315 * 10;
     tf.Handle :=  CreateFontIndirect(LogFont) ;

     lPDF.Canvas.Page.Font.Assign(tf);

Up to the point where I try to create the rotated font all is well.
I can write text using:
   lPDF.Canvas.TextOut(xe, ye, 'MINUTES');
And draw lines using:
  lPDF.Canvas.MoveTo(GraphLeft,ye);
  lPDF.Canvas.LineTo(GraphRight,ye);
  lPDF.Canvas.Stroke;

The code compiles, but when it tries to assign the font, I get:
'Cannot assign a tFont to a tPDFFontTrueType' error message.

Any additional help would be greatly appreciated.

Les

Offline

#4 2014-06-07 19:50:07

Lesh11
Member
Registered: 2014-06-07
Posts: 3

Re: Rotated text / logfont

Thanks all, I have resolved the issue using vcl canvas.

Les

Offline

Board footer

Powered by FluxBB