mail[Wesnoth-commits] r40081 - /trunk/src/widgets/menu.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on December 05, 2009 - 17:23:
Author: silene
Date: Sat Dec  5 17:23:18 2009
New Revision: 40081

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40081&view=rev
Log:
Converted menus to Pango rendering. (Partial fix for bug #14487.)

Modified:
    trunk/src/widgets/menu.cpp

Modified: trunk/src/widgets/menu.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/widgets/menu.cpp?rev=40081&r1=40080&r2=40081&view=diff
==============================================================================
--- trunk/src/widgets/menu.cpp (original)
+++ trunk/src/widgets/menu.cpp Sat Dec  5 17:23:18 2009
@@ -23,6 +23,7 @@
 #include "language.hpp"
 #include "marked-up_text.hpp"
 #include "sound.hpp"
+#include "text.hpp"
 #include "video.hpp"
 #include "wml_separators.hpp"
 
@@ -799,11 +800,11 @@
                                res.h = std::max<int>(img->h, res.h);
                        }
                } else {
-                       const SDL_Rect area = {0,0,10000,10000};
-                       const SDL_Rect font_size =
-                               
font::draw_text(NULL,area,get_font_size(),font::NORMAL_COLOUR,str,0,0);
-                       res.w += font_size.w;
-                       res.h = std::max<int>(font_size.h, res.h);
+                       font::ttext t;
+                       t.set_text(str, true);
+                       t.set_font_size(get_font_size());
+                       res.w += t.get_width();
+                       res.h = std::max<int>(t.get_height(), res.h);
                }
        }
        return res;
@@ -951,7 +952,15 @@
                                                : str;
                                const SDL_Rect& text_size = 
font::text_area(str,style_->get_font_size());
                                const size_t y = rect.y + (rect.h - 
text_size.h)/2;
-                               
font::draw_text(&video(),column,style_->get_font_size(),font::NORMAL_COLOUR,to_show,xpos,y);
+
+                               font::ttext t;
+                               t.set_text(to_show, true);
+                               t.set_font_size(style_->get_font_size());
+                               t.set_foreground_colour(0xDDDDDDFF);
+                               t.set_maximum_width(column.w);
+                               t.set_maximum_height(column.h);
+                               surface s = t.render();
+                               video().blit_surface(xpos, y, s);
 
                                if(type == HEADING_ROW && sortby_ == int(i)) {
                                        const surface sort_img = 
image::get_image(sortreversed_ ? "misc/sort-arrow.png" :




Related Messages


Powered by MHonArc, Updated Sat Dec 05 18:00:08 2009