あるフォントで文字列が描画されるサイズを求める
39 GetTextDrawSize 動作確認 Delphi2007 更新日 2008/01/19(土)

CanvasのTextWidthやTextHeightを使えば
ある文字列が描画されるサイズが求まります。

あるコントロールの描画サイズを求めるために
FormのCanvasを使ったりせずに
TBitmapを動的に生成して利用しましょう。

────────────────────
function GetTextWidth(Font: TFont; s: String): Integer;
begin
  with TBitmap.Create do try
  Canvas.Font.Assign(Font);
  Result := Canvas.TextWidth(s);
  finally Free; end;
end;

function GetTextHeight(Font: TFont;  s: String): Integer;
begin
  with TBitmap.Create do try
  Canvas.Font.Assign(Font);
  Result := Canvas.TextHeight(s);
  finally Free; end;
end;
────────────────────
『□』や『H』のサイズを求めると
あるフォントでの幅や高さの最大値が求まるようです。

参考────────────────────
RichEditで指定行を中央に表示するには
http://hpcgi1.nifty.com/MADIA/DelphiBBS/wwwlng.cgi?print+200801/08010002.txt