1
Graphics / Re: Understanding and adjusting BGRABitmap's handling of line distances
« Last post by circular on Today at 09:55:30 am »Hello ArchChem,
Welcome to the forum.
To investigate, I would need to reproduce the different of line spacings. It may depend on the font family and the system.
Can you provide a simple example that displays both line spacing? Something like this:
Welcome to the forum.
To investigate, I would need to reproduce the different of line spacings. It may depend on the font family and the system.
Can you provide a simple example that displays both line spacing? Something like this:
- uses BGRABitmap, BGRABitmapTypes;
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.FormPaint(Sender: TObject);
- var
- ts: TSize;
- style: TTextStyle;
- bmp: TBGRABitmap;
- halfX: integer;
- begin
- halfX := ClientWidth div 2;
- with Canvas do
- begin
- Brush.Color := clWhite;
- FillRect(0, 0, halfX, ClientHeight);
- Brush.Style := bsClear;
- Font.Color := clBlack;
- Font.Height := 50;
- Font.Name := 'Arial';
- ts := Canvas.TextExtent('Hello world');
- Rectangle(0, 0, ts.cx, ts.cy);
- TextOut(0, 0, 'Hello world');
- style := Canvas.TextStyle;
- style.Wordbreak:= true;
- style.SingleLine:= false;
- TextRect(rect(0, 50, halfX, ClientHeight),
- 0, 50, 'Text with'#13#10'Line endings', style);
- end;
- bmp := TBGRABitmap.Create(halfX, ClientHeight, BGRAWhite);
- with bmp.CanvasBGRA do
- begin
- Brush.Style := bsClear;
- Font.Color := clBlack;
- Font.Height := 50;
- Font.Name := 'Arial';
- ts := Canvas.TextExtent('Hello world');
- Rectangle(0, 0, ts.cx, ts.cy);
- TextOut(0, 0, 'Hello world');
- style := Canvas.TextStyle;
- style.Wordbreak:= true;
- style.SingleLine:= false;
- TextRect(rect(0, 50, halfX, ClientHeight),
- 0, 50, 'Text with'#13#10'Line endings', style);
- end;
- bmp.Draw(Canvas, halfX, 0);
- bmp.Free;
- end;