Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-08

Changing font colour

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Timothy Groves

So I've got a program that saves a graphic image, and I copied chunks of it from http://wiki.freepascal.org/fcl-image because I'm , whenever I draw text, it comes out in black, and I wish to be able to change the colour. I've hunted online and through the source code, and nothing seems to work. Can someone tell me what I'm doing wrong?

   Image := TFPMemoryImage.Create (1025,513);
   Image.UsePalette := FALSE;
   Canvas := TFPImageCanvas.Create (Image);
   FontMgr.SearchPath:='/usr/share/fonts/truetype/ttf-dejavu/';
   AFont := TFreeTypeFont.Create;
     Canvas.brush.FPCOlor := colWhite;
     Canvas.pen.FPColor := colWhite;
     Canvas.Font := aFont;
     Canvas.Font.Name := 'DejaVuSerif';
     Canvas.Font.Size := 6 + ZoomFactor;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130803/49275116/attachment.html>

Reply by email

Mattias Gaertner
to Timothy Groves
Show quoted text 17 lines
So I've got a program that saves a graphic image, and I copied chunks of it from http://wiki.freepascal.org/fcl-image because I'm new at this. However, whenever I draw text, it comes out in black, and I wish to be able to change the colour. I've hunted online and through the source code, and nothing seems to work. Can someone tell me what I'm doing wrong? Image := TFPMemoryImage.Create (1025,513); Image.UsePalette := FALSE; Canvas := TFPImageCanvas.Create (Image); FontMgr.SearchPath:='/usr/share/fonts/truetype/ttf-dejavu/'; AFont := TFreeTypeFont.Create; Canvas.brush.FPCOlor := colWhite; Canvas.pen.FPColor := colWhite; Canvas.Font := aFont; Canvas.Font.Name := 'DejaVuSerif'; Canvas.Font.Size := 6 + ZoomFactor;

Have you tried changing Canvas.Font.Color?

Mattias

Reply by email