From efdb488736d2c95a714bf6c9dc3a24c8b4fbf1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20de=20l=27Hamaide?= Date: Sun, 1 Dec 2013 18:50:44 +0100 Subject: [PATCH] Fix accent bug in MapWidget --- src/GUI/MapWidget.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index 137b83bf6..3c2cc8ba9 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -199,6 +199,11 @@ public: _width, _height); } + void drawStringUtf8(std::string& utf8Str, double x, double y, puFont fnt) + { + fnt.drawString(simgear::strutils::utf8ToLatin1(utf8Str).c_str(), x, y); + } + void draw() { validate(); @@ -218,12 +223,12 @@ public: glColor3f(0.8, 0.8, 0.8); for (unsigned int ln=0; ln<_lines.size(); ++ln) { - _font.drawString(_lines[ln].c_str(), xPos, yPos); + drawStringUtf8(_lines[ln], xPos, yPos, _font); yPos -= lineHeight + LINE_LEADING; } } else { glColor3f(0.8, 0.8, 0.8); - _font.drawString(_label.c_str(), xx, yy + _fontDescender); + drawStringUtf8(_label, xx, yy + _fontDescender, _font); } }