GNOME Bugzilla – Bug 659633
Line wrapping is broken
Last modified: 2011-09-20 20:06:31 UTC
When running gnome-shell with clutter git (aka 1.8) text is not line wrapper but simply cut off and the rest not painted. Best to reproduce with doing notify-send $longtext and viewing the notification. I bisected it and it lead to: -------------- 359ed2b29fdc4f692e6cb6ff310c41ed7796139a is the first bad commit commit 359ed2b29fdc4f692e6cb6ff310c41ed7796139a Author: Emmanuele Bassi <ebassi@linux.intel.com> Date: Sun Sep 4 17:57:50 2011 +0100 text: Make :line-wrap actually work When we paint a ClutterText we ask the actor for a PangoLayout that fits inside the actor's allocation - both width and height. Sadly, whenever a height is set on a PangoLayout, Pango will wrap its contents - regardless of whether the layout should actually wrap or not. This means that in certain easy to exploit cases, Clutter will paint a Text actor with its contents wrapping even if the :wrap property is set to FALSE. In order to fix this we need to encode some more cases inside the ::paint implementation of ClutterText, and ask the cache for a layout that is sized as the allocation's width, but not as its height; we also need to perform a clip if we detect that the PangoLayout's logical size is going to overflow the allocated size. This clip might cause some performance issue, given that clipping breaks batching in the Cogl journal; hopefully all clips for text are going to be screen-aligned, so at the end of the batch it'll just scissor them out. http://bugzilla.clutter-project.org/show_bug.cgi?id=2339 :040000 040000 0e599b1538a8ac78e738a5f8fb5fa84d6413edea f2aa892e0dd7faaa594b502db28b7a4744537dad M clutter ------------- Wasn't the commit supposed to make it work? Here it seems to have achieved the opposite ;)
Created attachment 197105 [details] [review] clutter-text: Print get_preferred_height on click (In reply to comment #0) > When running gnome-shell with clutter git (aka 1.8) text is not line wrapper > but simply cut off and the rest not painted. > > Best to reproduce with doing notify-send $longtext and viewing the > notification. > The problem seems to be that the preferred height/width isn't taking line wrappiing into account. Simple patch to test-text to test it.
(In reply to comment #0) > When running gnome-shell with clutter git (aka 1.8) text is not line wrapper > but simply cut off and the rest not painted. are you setting the line-wrap property to TRUE in the first place? if you're not, then the only sane behaviour we can provide is to clip to the allocated area. please, read the original bug on clutter-project.org. if I remember correctly, the Shell is using :clip-to-allocation to work around the bug in other places, like the message tray. > Wasn't the commit supposed to make it work? Here it seems to have achieved the > opposite ;) it works as best as it can given the circumstances. (In reply to comment #1) > The problem seems to be that the preferred height/width isn't taking line > wrappiing into account. Simple patch to test-text to test it. if you pass -1 as the width for get_preferred_height() then the Text actor will not wrap — and it is the intended behaviour: you're asking the PangoLayout to give you it's preferred height for an unlimited width.
Created attachment 197108 [details] [review] messageTray: Fix line wrapping Clutter 1.4 had a bug where it would wrap when it wasn't supposed to, and we were unknowingly relying on it. Explicitly pass the available width/height to get a perfect allocation.
Review of attachment 197108 [details] [review]: Makes sense and works for me. Re commit message ... are you sure about the 1.4 part? The same code was in use for 1.6. I'd rather mention it was there pre 1.8
Attachment 197108 [details] pushed as 7e70dfd - messageTray: Fix line wrapping