View Issue Details

IDProjectCategoryView StatusLast Update
0035437LazarusWidgetsetpublic2019-06-09 16:43
ReportercircularAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.0Product Build 
Target VersionFixed in Version 
Summary0035437: Font orientation unnecessarily limited to whole degrees on Linux
DescriptionThe 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 ReproduceCreate 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 InformationThe two lines should have approximately the same orientation.
TagsNo tags attached.
Fixed in Revisionr61049
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0035697 closedJuha Manninen Patches Gtk3: fix font angle truncated to int 

Activities

circular

2019-04-24 16:11

developer  

test font orientation.png (11,046 bytes)
test font orientation.png (11,046 bytes)

Juha Manninen

2019-04-24 20:31

developer   ~0115778

I did the changes you proposed and the example code results look better. Please test.
How about GTK3?

circular

2019-06-07 10:33

developer   ~0116601

Sorry for the late reply. I don't have trunk version so I cannot help further. Regards

Issue History

Date Modified Username Field Change
2019-04-24 16:11 circular New Issue
2019-04-24 16:11 circular File Added: test font orientation.png
2019-04-24 20:27 Juha Manninen Assigned To => Juha Manninen
2019-04-24 20:27 Juha Manninen Status new => assigned
2019-04-24 20:30 Juha Manninen Status assigned => resolved
2019-04-24 20:30 Juha Manninen Resolution open => fixed
2019-04-24 20:31 Juha Manninen Fixed in Revision => r61049
2019-04-24 20:31 Juha Manninen LazTarget => -
2019-04-24 20:31 Juha Manninen Widgetset GTK 2 => GTK 2
2019-04-24 20:31 Juha Manninen Note Added: 0115778
2019-06-07 10:33 circular Note Added: 0116601
2019-06-09 16:43 Juha Manninen Relationship added related to 0035697