Bug 344552 - Title bar text gets wrapped up when using the Breeze Window Decoration
Summary: Title bar text gets wrapped up when using the Breeze Window Decoration
Status: RESOLVED FIXED
Alias: None
Product: Breeze
Classification: Plasma
Component: window decoration (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Hugo Pereira Da Costa
URL:
Keywords:
: 345351 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-25 08:20 UTC by Ronnie.P.Thomas
Modified: 2015-03-20 09:12 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Firefox wrapping up the text in titlebar (187.50 KB, image/png)
2015-02-25 08:26 UTC, Ronnie.P.Thomas
Details
The same happens in Dolphin as well (73.22 KB, image/png)
2015-02-25 08:26 UTC, Ronnie.P.Thomas
Details
Text cut off at the end - Firefox (139.76 KB, image/png)
2015-02-26 04:06 UTC, Ronnie.P.Thomas
Details
Text cut off at the end - Dolphin (73.31 KB, image/png)
2015-02-26 04:07 UTC, Ronnie.P.Thomas
Details
Text cut off at the begin - System Settings (40.79 KB, image/png)
2015-03-15 14:04 UTC, Mika Allan Rauhala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ronnie.P.Thomas 2015-02-25 08:20:01 UTC
The title bar doesn't show the entire title, but instead shortens the title and places three dots (...) in between the beggining and the end of the title. I would have understood if this behavious was used for extremely long titles, but the title is being wrapped up even for small titles. Please check the attachments below.

Reproducible: Always

Steps to Reproduce:
1. Select Breeze Window Decoration
2. Launch Application 

Actual Results:  
Title bar text gets wrapped up.

Expected Results:  
Title bar text should not get wrapped up, except for extremely long titles, like for eg:- long webpage titles in Firefox
Comment 1 Ronnie.P.Thomas 2015-02-25 08:24:20 UTC
The version of Breeze used was 5.2.0-2 (ArchLinux).
Comment 2 Ronnie.P.Thomas 2015-02-25 08:26:00 UTC
Created attachment 91289 [details]
Firefox wrapping up the text in titlebar
Comment 3 Ronnie.P.Thomas 2015-02-25 08:26:39 UTC
Created attachment 91290 [details]
The same happens in Dolphin as well
Comment 4 Hugo Pereira Da Costa 2015-02-25 22:04:14 UTC
Yes. I have seen that happen and seems a problem with font metrics calculations within Qt (some discrepancy between fontMetrics.boundingRect() and fontMetrics.elidedTex(). I had put in a workaround at that time (see: c6e35208c64032ada79b95aa213902a7851aef60), but it might not be enough, depending on the font. 
Right now, with the font I am using I cannot reproduce. Can you tell me which font you are using ? 
I'll investigate some more on my side. (might find a non-workaround fix).
Will keep you posted.

Thanks for reporting, 

Hugo
Comment 5 Hugo Pereira Da Costa 2015-02-25 23:17:51 UTC
Git commit a8d2104ab36c91053da1fee3ad31d68c979965a7 by Hugo Pereira Da Costa.
Committed on 25/02/2015 at 23:17.
Pushed by hpereiradacosta into branch 'Plasma/5.2'.

Added an explicit flag as output from captionRect to tell whether caption must be ellided or not.

M  +10   -8    kdecoration/breezedecoration.cpp
M  +7    -1    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/a8d2104ab36c91053da1fee3ad31d68c979965a7
Comment 6 Hugo Pereira Da Costa 2015-02-25 23:17:53 UTC
Git commit 8ebd33d72d24a2d6aaa73fb9978437bceb7c3091 by Hugo Pereira Da Costa.
Committed on 25/02/2015 at 23:17.
Pushed by hpereiradacosta into branch 'master'.

Added an explicit flag as output from captionRect to tell whether caption must be ellided or not.

M  +10   -8    kdecoration/breezedecoration.cpp
M  +7    -1    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/8ebd33d72d24a2d6aaa73fb9978437bceb7c3091
Comment 7 Hugo Pereira Da Costa 2015-02-25 23:18:55 UTC
ok. That should fix it. Don't hesitate to confirm (if you get a chance to compile breeze from source and/or apply the patch to the version you have). 
Feel free to re-open if bug reoccurs.

Best, 

Hugo
Comment 8 Ronnie.P.Thomas 2015-02-26 03:29:55 UTC
Thanks for your efforts, Hugo. I'm using the Noto Sans Regular font. I'll try to check whether the issue has been fixed.
Comment 9 Ronnie.P.Thomas 2015-02-26 04:03:01 UTC
Alright, the text isn't getting elided up any more, but it is now getting cut off at the end for some reason. Please check the attachments.
Comment 10 Ronnie.P.Thomas 2015-02-26 04:06:03 UTC
Created attachment 91298 [details]
Text cut off at the end - Firefox
Comment 11 Ronnie.P.Thomas 2015-02-26 04:07:05 UTC
Created attachment 91299 [details]
Text cut off at the end - Dolphin
Comment 12 Hugo Pereira Da Costa 2015-02-26 04:16:54 UTC
... crap.
I really suspect something wrong either in the Qt or in the font ... 
Thanks for posting the one you are using, I'll investigate further.
Comment 13 Hugo Pereira Da Costa 2015-02-26 04:17:50 UTC
basically, some 'text' does not fit into the fontMetrics::boundingRect() calculated from this text ... 
(so was getting elided in the past, and gets truncated now ...)
Comment 14 Ronnie.P.Thomas 2015-02-26 17:29:49 UTC
I tried changing my Window Title font to Oxygen Sans and it showed the title perfectly. I think there is something wrong with the Noto Sans font maybe. Oh, and I'm using the Infinality package for font rendering if that makes any difference.
Comment 15 Marc Payne 2015-03-05 12:19:28 UTC
I also use the Infinality patch set, but reverting to the stock packages offered by Arch has no effect on this bug. I can confirm that Oxygen Sans works fine for the title bars. Noto Sans also works for me, interestingly. Droid Sans and DejaVu Sans do not work.

My standard test application is Crashplan, a java program. The title bar merely displays "Cras...lan".

Maybe this info can help with replicating the bug. Thanks for your investigation, Hugo!
Comment 16 Hugo Pereira Da Costa 2015-03-05 12:37:09 UTC
oh I can replicate the bug no worry
just have no idea so far on how to fix :)
(well, have some ideas but had no time to test)
Comment 17 Hugo Pereira Da Costa 2015-03-13 09:30:15 UTC
Git commit 850906e9d78e1b928d2865057310d4f52caabe6c by Hugo Pereira Da Costa.
Committed on 13/03/2015 at 09:26.
Pushed by hpereiradacosta into branch 'Plasma/5.2'.

removed ellision flag from captionRect (broken anyway)
ellide caption text directly at rendering and not prior, using fontMetrics::elidedText
seems to 'fix' overzealous ellision

M  +3    -10   kdecoration/breezedecoration.cpp
M  +2    -6    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/850906e9d78e1b928d2865057310d4f52caabe6c
Comment 18 Hugo Pereira Da Costa 2015-03-13 09:30:17 UTC
Git commit 6195ee0b0a4b2e06aa6b91b5242a5a8adac95dce by Hugo Pereira Da Costa.
Committed on 13/03/2015 at 09:26.
Pushed by hpereiradacosta into branch 'master'.

removed ellision flag from captionRect (broken anyway)
ellide caption text directly at rendering and not prior, using fontMetrics::elidedText
seems to 'fix' overzealous ellision

M  +3    -10   kdecoration/breezedecoration.cpp
M  +2    -6    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/6195ee0b0a4b2e06aa6b91b5242a5a8adac95dce
Comment 19 Hugo Pereira Da Costa 2015-03-13 09:32:08 UTC
new attempt. Any chance you can give it a shot ? It does work here for cases where I had ellided text that should not be.
If it still doesn't work, I have other ideas (this fix is rather simple and might be due to me mis-interpretting the Qt API)
Otherwise, well, feel free to close :)

Thanks, 
Hugo
Comment 20 Mika Allan Rauhala 2015-03-15 12:39:25 UTC
Now the text gets cut off at the begin. I don't remember having problems with ellision, but I did with text getting cut off at the end.
Comment 21 Hugo Pereira Da Costa 2015-03-15 13:58:56 UTC
Hi Mika,
thanks for the feedback
can you provide the font you are using, fontsize, and an example of window where the text is cut off ? 
I'll go ahead and code the plans I have for a more robust implementation (as a matter of fact it seems that boundingRect and ellideText don't play nice one with the other)
Comment 22 Mika Allan Rauhala 2015-03-15 14:04:04 UTC
Created attachment 91568 [details]
Text cut off at the begin - System Settings
Comment 23 Mika Allan Rauhala 2015-03-15 14:05:47 UTC
I'm using DejaVu Sans, 9pt as window title font.
Comment 24 Hugo Pereira Da Costa 2015-03-15 14:10:46 UTC
Can reproduce, thanks !
Comment 25 Ronnie.P.Thomas 2015-03-16 07:30:05 UTC
Hello,

Sorry for the late reply. I'm also experiencing the same effects as Mika. The text is getting cut off at the beggining of the title. I'm using Noto Sans Regular (Size - 10) as before. Oxygen Sans is still unaffected, and is showing the title properly.
Comment 26 Hugo Pereira Da Costa 2015-03-16 09:05:14 UTC
Hi I think I finally have a patch that should work this time. In any case previous one is definitely broken as far as I can tell (no text elision any more, plus truncated title: worse of both worlds) 
Anyway, I'll test some more and push later today. 
Thanks for your patience
Comment 27 Hugo Pereira Da Costa 2015-03-16 09:35:46 UTC
Git commit 8568a80a6ed05c260b088528f5f59957cd1c53e0 by Hugo Pereira Da Costa.
Committed on 16/03/2015 at 09:26.
Pushed by hpereiradacosta into branch 'Plasma/5.2'.

Pass both caption rect and alignment as output from ::captionRect
Use largest possible rect for all combinations, to avoid truncation
Adjust alignment flags accordingly.

M  +21   -28   kdecoration/breezedecoration.cpp
M  +1    -1    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/8568a80a6ed05c260b088528f5f59957cd1c53e0
Comment 28 Hugo Pereira Da Costa 2015-03-16 09:35:49 UTC
Git commit 79ffe5e50e6b20b3d3275744c5df0662986be415 by Hugo Pereira Da Costa.
Committed on 16/03/2015 at 09:26.
Pushed by hpereiradacosta into branch 'master'.

Pass both caption rect and alignment as output from ::captionRect
Use largest possible rect for all combinations, to avoid truncation
Adjust alignment flags accordingly.

M  +22   -27   kdecoration/breezedecoration.cpp
M  +1    -1    kdecoration/breezedecoration.h

http://commits.kde.org/breeze/79ffe5e50e6b20b3d3275744c5df0662986be415
Comment 29 Ronnie.P.Thomas 2015-03-16 09:49:41 UTC
Alright, good news!! The title bar is working as expected and the really long titles which can't fit in the title bar are also getting elided.... great job Hugo! Guess this bug can now be marked as resolved.
Comment 30 Mika Allan Rauhala 2015-03-16 13:38:48 UTC
It's now working here too.
Comment 31 Hugo Pereira Da Costa 2015-03-16 13:56:58 UTC
ok.
closing.
Thanks
Comment 32 Hugo Pereira Da Costa 2015-03-20 09:12:07 UTC
*** Bug 345351 has been marked as a duplicate of this bug. ***