2

Not sure if I'm missing something here but are you able to set font color in Firemonkey TCanvas?

I don't see anything to suggest this in the following property:

Canvas.Font. ????

Any help would be great

Thanks,

6String_Coder
  • 517
  • 10
  • 30
  • Set `Canvas.Fill.Color` ? – RepeatUntil May 24 '16 at 16:24
  • @RepeatUntil: yes, [`Canvas.Fill`](http://docwiki.embarcadero.com/Libraries/en/FMX.Graphics.TCanvas.Fill) is the correct property to use, such as when calling [`Canvas.FillText()`](http://docwiki.embarcadero.com/Libraries/en/FMX.Graphics.TCanvas.FillText). – Remy Lebeau May 24 '16 at 17:52

1 Answers1

3

Test this code. put an Image on the form and a button.

procedure TForm1.Button1Click(Sender: TObject);
var
  b:TBitmap;
  f:TFont;
begin
  b:=TBitmap.Create;
  f:=TFont.Create;
  try
    f.Family:='Arial';
    f.Size:=20;
    f.Style:=[TFontStyle.fsBold];
    b.Width:=200;
    b.Height:=200;
    b.Canvas.BeginScene;
    b.Canvas.Fill.Color:=TAlphaColorRec.red;
    b.Canvas.Font.Assign(f);
    b.Canvas.FillText(TRectF.Create(0,0,100,100),'AAA',False,1,[TFillTextFlag.RightToLeft], TTextAlign.Leading,TTextAlign.Center);
    b.Canvas.EndScene;
    image1.Bitmap:=b;
  finally
   b.Free;
   f.Free;
  end;
end;
Loghman
  • 1,500
  • 1
  • 14
  • 30