Author: mordante
Date: Thu Oct 22 21:16:24 2009
New Revision: 39414
URL: http://svn.gna.org/viewcvs/wesnoth?rev=39414&view=rev
Log:
Improve handling invalid markup.
The code tried to render the markup before but since that doesn't fit on
the canvas it showed an wml_exception. Now handle it in the text code
itself.
After the stringfreeze is gone there can be a better warning.
Modified:
trunk/changelog
trunk/src/gui/auxiliary/canvas.cpp
trunk/src/text.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=39414&r1=39413&r2=39414&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Oct 22 21:16:24 2009
@@ -1,6 +1,8 @@
Version 1.7.7+svn:
* Language and i18n:
* Updated translations:
+ * User interface:
+ * Instead of "crashing" upon invalid markup try to show the raw text
Version 1.7.7:
* AI:
Modified: trunk/src/gui/auxiliary/canvas.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/canvas.cpp?rev=39414&r1=39413&r2=39414&view=diff
==============================================================================
--- trunk/src/gui/auxiliary/canvas.cpp (original)
+++ trunk/src/gui/auxiliary/canvas.cpp Thu Oct 22 21:16:24 2009
@@ -884,11 +884,7 @@
}
static font::ttext text_renderer;
- if(!text_renderer.set_text(text, text_markup_(variables))) {
- ERR_GUI_D << "Text: Invalid markup in '"
- << text << "' rendered as is.\n";
- text_renderer.set_text(text, false);
- }
+ text_renderer.set_text(text, text_markup_(variables));
text_renderer.set_font_size(font_size_).
set_font_style(font_style_).
Modified: trunk/src/text.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/text.cpp?rev=39414&r1=39413&r2=39414&view=diff
==============================================================================
--- trunk/src/text.cpp (original)
+++ trunk/src/text.cpp Thu Oct 22 21:16:24 2009
@@ -16,6 +16,7 @@
#include "text.hpp"
+#include "gettext.hpp"
#include "gui/widgets/helper.hpp"
#include "gui/auxiliary/log.hpp"
#include "font.hpp"
@@ -264,6 +265,12 @@
if(!pango_parse_markup(text.c_str(), text.size()
, 0, NULL, NULL, NULL, NULL)) {
+ ERR_GUI_L << "ttext::" << __func__
+ << " text '" << text
+ << "' has broken markup, set to
normal text.\n";
+ /** @todo Enable after 1.8. */
+// set_text(_("The text contains invalid markup:
") + text, false);
+ set_text(text, false);
return false;
}
pango_layout_set_markup(layout_, text.c_str(),
text.size());
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits