There should be no empty space below or above the text.
I tested with this code (form + paintbox, paintbox.Font.Size := 32), and it results in the attached screenshot (Win 10):
procedure TForm1.DrawText(x, y: Integer; AText: String);
var
sz: TSize;
begin
with Paintbox1.Canvas do begin
Font.Assign(Paintbox1.Font);
sz := TextExtent(AText);
Brush.Color := clWhite;
Pen.Color := clBlack;
Rectangle(x, y, x + sz.cx, y + sz.cy);
Brush.Style := bsClear;
TextOut(x, y, AText);
Pen.Color := clRed;
Line(x, y + sz.cy div 2, x + sz.cx, y + sz.cy div 2);
end;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
DrawText(10, 10, 'ABC');
DrawText(110, 10, 'abc');
DrawText(210, 10, 'gj');
end;
There IS some white space above and below the text. It is distributed more or less evenly at the top and bottom of the text if the text contains upper-case characters, In case of lower-case characters, however, the center of the bounding box (red line) is markably shifted from where it should appear visually.