Board index » delphi » Putting Font Name in TLogFont Structure - Help !!

Putting Font Name in TLogFont Structure - Help !!

I'm trying to put the name of an existing font into a TLogFont structure (in
order to rotate it) and I keep getting incompatibilities.

I've either got a severe case of "mental blockage" or its an obscure technique
<g>.

I code :-
var
  FontName : string;
 . . . and . . .
FontName := Printer.Canvas.Font.Name;

Now I want to put it into TLogFont.lfFontName and I've tried copying it inot a
PChar, typecasting to a PChar. I've even tried

var
  FontName : TFontName;

    FN := 'Comic Sans MS';

. . . and . . .

const
  FontName : array[0..LF_FACESIZE-1] of ansichar = ('C', 'o', 'm', 'i', 'c', '
', 'S',
  'a', 'n', 's', ' ', 'M', 'S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '
',
   ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');

 .  . and the compiler responds with incompatible types or incompatible Array
and TLogFont..

Yet Windows.PAS has . . .

    lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;

 . . . in it.

 . . . and Canvas.Font.Name is of type TFontName ie string(LF_FACESIZE-1]

Help - Please

Alan Lloyd
alangll...@aol.com

 

Re:Putting Font Name in TLogFont Structure - Help !!


I'm trying to put the name of an existing font into a TLogFont structure (in
order to rotate it) and I keep getting incompatibilities.

I've either got a severe case of "mental blockage" or its an obscure technique
<g>.

I code :-
var
  FontName : string;
 . . . and . . .
FontName := Printer.Canvas.Font.Name;

Now I want to put it into TLogFont.lfFontName and I've tried copying it inot a
PChar, typecasting to a PChar. I've even tried

var
  FontName : TFontName;

    FN := 'Comic Sans MS';

. . . and . . .

const
  FontName : array[0..LF_FACESIZE-1] of ansichar = ('C', 'o', 'm', 'i', 'c', '
', 'S',
  'a', 'n', 's', ' ', 'M', 'S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '
',
   ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');

 .  . and the compiler responds with incompatible types or incompatible Array
and TLogFont..

Yet Windows.PAS has . . .

    lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;

 . . . in it.

 . . . and Canvas.Font.Name is of type TFontName ie string(LF_FACESIZE-1]

Help - Please

Alan Lloyd
alangll...@aol.com

Other Threads