View Issue Details

IDProjectCategoryView StatusLast Update
0036128LazarusWidgetsetpublic2019-10-06 10:59
ReporterAlexey Tor.Assigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUbuntu x64OSOS Version
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0036128: Gtk2: Japanese text of TLabel is rendered cropped
Descriptiondemo program has TPanel with child TLabel (label anchored vertically to the center).
Japanese text of Label shows cropped, screen attached.
TagsNo tags attached.
Fixed in Revisionr61959
LazTarget-
WidgetsetGTK 2
Attached Files
  • tst-jp-label.zip (2,089 bytes)
  • l.diff (655 bytes)
    Index: lcl/interfaces/gtk2/gtk2winapi.inc
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 61957)
    +++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
    @@ -2465,7 +2465,10 @@
           TextExtentPoint(PChar(AStr), length(AStr), AP{%H-});
           theRect.Bottom := theRect.Top + TM.tmHeight;
           if (Flags and DT_CALCRECT)<>0 then
    -        theRect.Right := theRect.Left +  AP.cX
    +      begin
    +        theRect.Right := theRect.Left +  AP.cX;
    +        theRect.Bottom := theRect.Top +  AP.cY;
    +      end
           else
           begin
             theRect.Right := theRect.Left + Min(MaxWidth, AP.cX);
    
    l.diff (655 bytes)

Activities

Alexey Tor.

2019-10-02 14:24

reporter  

tst-jp-label.zip (2,089 bytes)

Alexey Tor.

2019-10-02 15:25

reporter   ~0118252

found the reason. DrawText of WS is used to calculate needed rect. It had missing setting of Rect.Height in gtk2.
fix added.

l.diff (655 bytes)
Index: lcl/interfaces/gtk2/gtk2winapi.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 61957)
+++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
@@ -2465,7 +2465,10 @@
       TextExtentPoint(PChar(AStr), length(AStr), AP{%H-});
       theRect.Bottom := theRect.Top + TM.tmHeight;
       if (Flags and DT_CALCRECT)<>0 then
-        theRect.Right := theRect.Left +  AP.cX
+      begin
+        theRect.Right := theRect.Left +  AP.cX;
+        theRect.Bottom := theRect.Top +  AP.cY;
+      end
       else
       begin
         theRect.Right := theRect.Left + Min(MaxWidth, AP.cX);
l.diff (655 bytes)

Juha Manninen

2019-10-03 14:21

developer   ~0118273

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-10-02 14:24 Alexey Tor. New Issue
2019-10-02 14:24 Alexey Tor. File Added: tst-jp-label.zip
2019-10-02 14:24 Alexey Tor. File Added: Screenshot from 2019-10-02 15-21-17.png
2019-10-02 15:25 Alexey Tor. File Added: l.diff
2019-10-02 15:25 Alexey Tor. Note Added: 0118252
2019-10-03 14:12 Juha Manninen Assigned To => Juha Manninen
2019-10-03 14:12 Juha Manninen Status new => assigned
2019-10-03 14:21 Juha Manninen Status assigned => resolved
2019-10-03 14:21 Juha Manninen Resolution open => fixed
2019-10-03 14:21 Juha Manninen Fixed in Revision => r61959
2019-10-03 14:21 Juha Manninen LazTarget => -
2019-10-03 14:21 Juha Manninen Widgetset GTK 2 => GTK 2
2019-10-03 14:21 Juha Manninen Note Added: 0118273