diff options
author | est31 <MTest31@outlook.com> | 2015-07-07 05:55:07 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-07-08 10:12:44 +0200 |
commit | b0784ba87168e24b0533fc8718a0157cda5ea405 (patch) | |
tree | 24ca04bbfe2a13193400493e1bde5e520c589e03 /src/hud.cpp | |
parent | e234d8b3786d5adfbdf3d1a2123c3e8d91c21880 (diff) | |
download | minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.tar.gz minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.tar.bz2 minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.zip |
Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
Diffstat (limited to 'src/hud.cpp')
-rw-r--r-- | src/hud.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hud.cpp b/src/hud.cpp index 02b69a12c..dbc4a01a3 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -275,7 +275,7 @@ void Hud::drawLuaElements(v3s16 camera_offset) { (e->number >> 8) & 0xFF, (e->number >> 0) & 0xFF); core::rect<s32> size(0, 0, e->scale.X, text_height * e->scale.Y); - std::wstring text = narrow_to_wide(e->text); + std::wstring text = utf8_to_wide(e->text); core::dimension2d<u32> textsize = font->getDimension(text.c_str()); v2s32 offset((e->align.X - 1.0) * (textsize.Width / 2), (e->align.Y - 1.0) * (textsize.Height / 2)); @@ -310,11 +310,11 @@ void Hud::drawLuaElements(v3s16 camera_offset) { (e->number >> 8) & 0xFF, (e->number >> 0) & 0xFF); core::rect<s32> size(0, 0, 200, 2 * text_height); - std::wstring text = narrow_to_wide(e->name); + std::wstring text = utf8_to_wide(e->name); font->draw(text.c_str(), size + pos, color); std::ostringstream os; - os<<distance<<e->text; - text = narrow_to_wide(os.str()); + os << distance << e->text; + text = utf8_to_wide(os.str()); pos.Y += text_height; font->draw(text.c_str(), size + pos, color); break; } @@ -552,7 +552,7 @@ void drawItemStack(video::IVideoDriver *driver, { // Get the item count as a string std::string text = itos(item.count); - v2u32 dim = font->getDimension(narrow_to_wide(text).c_str()); + v2u32 dim = font->getDimension(utf8_to_wide(text).c_str()); v2s32 sdim(dim.X,dim.Y); core::rect<s32> rect2( |