Author: mordante
Date: Thu Mar 17 20:41:19 2011
New Revision: 48928

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48928&view=rev
Log:
Implemented underline in the gui2 font style.

Modified:
    trunk/changelog
    trunk/src/text.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=48928&r1=48927&r2=48928&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Mar 17 20:41:19 2011
@@ -39,6 +39,7 @@
    * Fixed: Image widget now honors its minimum and maximum size.
    * Fixed: Black lines in the minimap.
    * Fixed: tooltips no longer capture the keyboard (bug #17797).
+   * Changed: Allow underline in the gui2 font style.
  * WML engine:
    * Added support for map_passable and leader_passable for [placement]
    * Allow [color_range] and [color_palette] nodes to be inserted at top-level

Modified: trunk/src/text.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/text.cpp?rev=48928&r1=48927&r2=48928&view=diff
==============================================================================
--- trunk/src/text.cpp (original)
+++ trunk/src/text.cpp Thu Mar 17 20:41:19 2011
@@ -462,7 +462,7 @@
                                pango_font_description_set_weight(font_, 
PANGO_WEIGHT_BOLD);
                        }
                        if(style & ttext::STYLE_UNDERLINE) {
-                               assert(false); // Not implemented yet
+                               /* Do nothing here, underline is a property of 
the layout. */
                        }
                }
        }
@@ -493,6 +493,15 @@
 
                tfont font(get_font_families(), font_size_, font_style_);
                pango_layout_set_font_description(layout_, font.get());
+
+               if(font_style_ & ttext::STYLE_UNDERLINE) {
+                       PangoAttrList *attribute_list = pango_attr_list_new();
+                       pango_attr_list_insert(attribute_list
+                                       , 
pango_attr_underline_new(PANGO_UNDERLINE_SINGLE));
+
+                       pango_layout_set_attributes (layout_, attribute_list);
+                       pango_attr_list_unref(attribute_list);
+               }
 
                /*
                 * See set_maximum_width for some more background info as well.


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to