Don't. Paint the text with DrawText
/DrawTextEx
and specify DT_CENTER
in the format parameter. See also Draw text multiline in the centre of a rect.
Or if you want or need to calculate it yourself:
procedure DrawCenteredText(Canvas: TCanvas; const S: String; R: TRect);
var
Left: Integer;
begin
Left := R.Left + (R.Right - R.Left - Canvas.TextWidth(S)) div 2;