From 467065bab257b23d7783088563ff82459e9179c9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 6 Jan 2009 22:56:43 +0100 Subject: Fixed the true type font to render unicode now --- src/gui/gui.cpp | 6 +++--- src/gui/truetypefont.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index f7f582fb..87bab0ea 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include "focushandler.h" #include "sdlinput.h" @@ -46,7 +45,7 @@ // Guichan stuff Gui *gui; Viewport *viewport; /**< Viewport on the map. */ -SDLInput *guiInput; /**< GUI input. */ +SDLInput *guiInput; // Fonts used in showing hits gcn::Font *hitRedFont; @@ -104,8 +103,9 @@ Gui::Gui(Graphics *graphics): Window::setWindowContainer(guiTop); setTop(guiTop); - // Set global font ResourceManager *resman = ResourceManager::getInstance(); + + // Set global font std::string path = resman->getPath("fonts/dejavusans.ttf"); try { mGuiFont = new TrueTypeFont(path, 11); diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 9343c224..0eed6f08 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -55,7 +55,7 @@ class TextChunk sdlCol.r = color.r; sdlCol.g = color.g; - SDL_Surface *surface = TTF_RenderText_Blended( + SDL_Surface *surface = TTF_RenderUTF8_Blended( font, text.c_str(), sdlCol); if (!surface) @@ -167,7 +167,7 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, int TrueTypeFont::getWidth(const std::string &text) const { int w, h; - TTF_SizeText(mFont, text.c_str(), &w, &h); + TTF_SizeUTF8(mFont, text.c_str(), &w, &h); return w; } -- cgit v1.2.3-70-g09d2