Font orientation unnecessarily limited to whole degrees on Linux
Original Reporter info from Mantis: circular
-
Reporter name:
Original Reporter info from Mantis: circular
- Reporter name:
Description:
The font Orientation property is in tenth of degrees. On Linux, this value is truncated to whole degrees though I don't think it is necessary to do that and is not consistent with Windows implementation.
I found two lines of code that do this.
In interfaces/gtk2/gtk2devicecontext.inc on line 1342 of procedure TGtkDeviceContext.DrawTextWithColors :
pango_matrix_rotate(@NewMatrix, AFont^.LogFont.lfEscapement div 10);
this could be replaced by a floating point division as the parameter is type Double.
In interfaces/gtk2/gtk2winapi.inc on line 2540 in nested procedure CalculateOffsetWithAngle of function TGtk2WidgetSet.DrawText :
Angle := AFontAngle div 10;
this could be replaced by a floating point division and Angle would be a Double.
Steps to reproduce:
Create new application with a form. In the OnPaint event, write:
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Font.Size := 12;
Canvas.Font.Orientation := -9;
Canvas.TextOut(10,10, 'This is almost one degree of rotation');
Canvas.Font.Orientation := -10;
Canvas.TextOut(10,40, 'This is exactly one degree of rotation');
end;
Additional information:
The two lines should have approximately the same orientation.
Mantis conversion info:
- Mantis ID: 35437
- Version: 2.0
- Fixed in revision: r61049 (#bf45896b)