View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0036293 | Lazarus | Widgetset | public | 2019-11-11 13:55 | 2019-11-12 23:29 |
Reporter | CudaText man | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Ubuntu 19 x64 | OS | OS Version | ||
Product Version | 2.1 (SVN) | Product Build | |||
Target Version | Fixed in Version | ||||
Summary | 0036293: gtk2: Incorrect rendering of multiline label with Japanese text | ||||
Description | Demo shows the problem- multi-line label renders with bad height of wrapped parts. 2 screenshots-- before the fix, after the fix. fix added. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r62231 | ||||
LazTarget | - | ||||
Widgetset | GTK 2 | ||||
Attached Files |
|
related to | 0036292 | resolved | Juha Manninen | gtk3: Problem with label autosize with Japanese text |
|
t.diff (2,098 bytes)
Index: lcl/interfaces/gtk2/gtk2winapi.inc =================================================================== --- lcl/interfaces/gtk2/gtk2winapi.inc (revision 62230) +++ lcl/interfaces/gtk2/gtk2winapi.inc (working copy) @@ -2408,6 +2408,8 @@ l: LongInt; Pt: TPoint; SavedRect: TRect; // if font orientation <> 0 + LineHeight: Integer; + Size: TSize; function LeftOffset: Longint; begin @@ -2453,7 +2455,7 @@ var AP: TSize; J, MaxWidth, - LineWidth: Integer; + LineWidth, ActualHeight: Integer; begin theRect := Rect; @@ -2497,6 +2499,7 @@ if (Flags and DT_CALCRECT)<>0 then begin LineWidth := 0; + ActualHeight := 0; if (Lines <> nil) then begin for J := 0 to NumLines - 1 do @@ -2503,14 +2506,18 @@ begin TextExtentPoint(Lines[J], StrLen(Lines[J]), AP); LineWidth := Max(LineWidth, AP.cX); + Inc(ActualHeight, AP.cY); end; end; LineWidth := Min(MaxWidth, LineWidth); end else + begin LineWidth := MaxWidth; + ActualHeight := NumLines*TM.tmHeight; + end; theRect.Right := theRect.Left + LineWidth; - theRect.Bottom := theRect.Top + NumLines*TM.tmHeight; + theRect.Bottom := theRect.Top + ActualHeight; if NumLines>1 then Inc(theRect.Bottom, (NumLines-1)*TM.tmExternalLeading);// space between lines @@ -2771,12 +2778,17 @@ and (tm.tmHeight > (theRect.Bottom - theRect.Top)) then Break; - if Lines[i] <> nil then begin + if Lines[i] <> nil then + begin l:=StrLen(Lines[i]); DrawLine(Lines[i], l, theRect.Top); dec(pIndex,l+length(LineEnding)); - end; - Inc(theRect.Top, TM.tmExternalLeading + TM.tmHeight);// space between lines + GetTextExtentPoint(DC, Lines[i], l, Size); + LineHeight := Size.cY; + end + else + LineHeight := TM.tmHeight; + Inc(theRect.Top, LineHeight + TM.tmExternalLeading);// space between lines end; finally |
|
tst-jp-label.zip (3,137 bytes) |
|
Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-11-11 13:55 | CudaText man | New Issue | |
2019-11-11 13:55 | CudaText man | File Added: gtk2-before.png | |
2019-11-11 13:55 | CudaText man | File Added: gtk2-after.png | |
2019-11-11 13:55 | CudaText man | File Added: t.diff | |
2019-11-11 13:56 | CudaText man | File Added: tst-jp-label.zip | |
2019-11-12 23:14 | Juha Manninen | Relationship added | related to 0036292 |
2019-11-12 23:19 | Juha Manninen | Assigned To | => Juha Manninen |
2019-11-12 23:19 | Juha Manninen | Status | new => assigned |
2019-11-12 23:29 | Juha Manninen | Status | assigned => resolved |
2019-11-12 23:29 | Juha Manninen | Resolution | open => fixed |
2019-11-12 23:29 | Juha Manninen | Fixed in Revision | => r62231 |
2019-11-12 23:29 | Juha Manninen | LazTarget | => - |
2019-11-12 23:29 | Juha Manninen | Widgetset | GTK 2 => GTK 2 |
2019-11-12 23:29 | Juha Manninen | Note Added: 0119245 |