Draw autosize text in rect lazarus / 39-Graphics ---------------------------------------------------------------------- aradeonas · 2015-11-17 08:31 Hi, How can I draw text in rect with an Autosize system that it choose what font size it need to be fit in rect. It can be good to be in BGRABitmap or default canvas or whatever. ---------------------------------------------------------------------- balazsszekely · 2015-11-17 08:45 Let's say you want to fit a specific text into a panel. You can do something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  Txt: string;  w, h: Integer;  begin  Txt := 'This is a test';  Panel1.Canvas.Font.Name := 'Tahoma';  Panel1.Canvas.GetTextSize(Txt, w, h);  while (w < Panel1.Canvas.Width) and (h < Panel1.Canvas.Height) do  begin    Panel1.Canvas.Font.Size := Panel1.Canvas.Font.Size + 1;  Panel1.Canvas.GetTextSize(Txt, w, h);  end;  ShowMessage(IntToStr(Panel1.Canvas.Font.Size));end; In the end you will get the biggest font of the text which still fits into the panel.  Is this what are you after? ---------------------------------------------------------------------- aradeonas · 2015-11-17 11:11 Thanks. I add a demo in BGRABitmap board here.