Merge lp:~majcherlk/widelands/bug-1387784 into lp:widelands

Proposed by Lukasz
Status: Work in progress
Proposed branch: lp:~majcherlk/widelands/bug-1387784
Merge into: lp:widelands
Diff against target: 27 lines (+11/-0)
1 file modified
src/ui_basic/textarea.cc (+11/-0)
To merge this branch: bzr merge lp:~majcherlk/widelands/bug-1387784
Reviewer Review Type Date Requested Status
SirVer Needs Fixing
Review via email: mp+242672@code.launchpad.net

Description of the change

Now when the text doesn't fit in the Warehouse window the font is changed to smaller one.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Welcome Lukasz and thanks for the patch :).

This patch is technically correct, but they drag a dependency on wui (widelands ui) into basic ui which is not desirable. basic ui is more fundamental than wui.

review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

We will have another method of fixing this once the fh1 branch has been merged. The new renderer creates a LayoutInfo object that will have the resulting size recorded, so we can hook into that.

I would also go for picking the compressed font before reducing the font size. This will be possible after the fonts branch has been merged.

Revision history for this message
Lukasz (majcherlk) wrote :

Thanks for information and suggestions,
I will try fix that after fonts branch merge.

Revision history for this message
SirVer (sirver) wrote :

I am setting this back to work in progress so that it gets out of the review queue. Please ping here if you continued working on it.

Unmerged revisions

7277. By Lukasz

using smaller font when text is overflowing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ui_basic/textarea.cc'
--- src/ui_basic/textarea.cc 2014-11-22 10:18:20 +0000
+++ src/ui_basic/textarea.cc 2014-11-24 15:39:15 +0000
@@ -20,6 +20,7 @@
20#include "ui_basic/textarea.h"20#include "ui_basic/textarea.h"
2121
22#include "graphic/font_handler.h"22#include "graphic/font_handler.h"
23#include "wui/text_constants.h"
2324
24namespace UI {25namespace UI {
2526
@@ -118,6 +119,16 @@
118 if (m_text == text)119 if (m_text == text)
119 return;120 return;
120121
122 int font_size=UI_FONT_SIZE_SMALL;
123 m_textstyle.font=Font::get(UI_FONT_SMALL);
124
125 if(this->get_parent()->get_inner_w() != 0){
126 while(font_size>0 && m_textstyle.calc_bare_width(text) > this->get_parent()->get_inner_w()){
127 font_size--;
128 m_textstyle.font=Font::get(UI_FONT_NAME, font_size);
129 }
130 }
131
121 if (m_layoutmode == AutoMove)132 if (m_layoutmode == AutoMove)
122 collapse(); // collapse() implicitly updates133 collapse(); // collapse() implicitly updates
123134

Subscribers

People subscribed via source and target branches

to status/vote changes: