Merge lp:~azzar1/unity/lp-1190275 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3561
Proposed branch: lp:~azzar1/unity/lp-1190275
Merge into: lp:unity
Diff against target: 23 lines (+12/-1)
1 file modified
unity-shared/StaticCairoText.cpp (+12/-1)
To merge this branch: bzr merge lp:~azzar1/unity/lp-1190275
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+189932@code.launchpad.net

Commit message

Fix rendering of italic text in StaticCairoText.

Description of the change

== Problem ==
Bug #1190275: [Regression] Text in search bar is cut at the end of the last letter.

== Fix ==
ink_rect can be bigger of logic_rect for italic text. Seems like a pango issue, but we need to workaround it in unity.

== Test ==
N/A

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/StaticCairoText.cpp'
2--- unity-shared/StaticCairoText.cpp 2013-05-02 23:07:06 +0000
3+++ unity-shared/StaticCairoText.cpp 2013-10-08 18:12:14 +0000
4@@ -579,7 +579,18 @@
5 (float) dpi / (float) PANGO_SCALE);
6 }
7 pango_layout_context_changed(layout);
8- pango_layout_get_pixel_size(layout, &result.width, &result.height);
9+
10+ PangoRectangle ink_rect, logic_rect;
11+ pango_layout_get_pixel_extents(layout, &ink_rect, &logic_rect);
12+
13+ result.height = logic_rect.height;
14+
15+ // See bug https://bugs.launchpad.net/unity/+bug/1190275
16+ // "Text in search bar is cut at the end of the last letter"
17+ if (ink_rect.width > logic_rect.width)
18+ result.width = ink_rect.width;
19+ else
20+ result.width = logic_rect.width;
21
22 if (result.width > parent_->GetMaximumWidth())
23 {