From 1a2670629526a93b9862fc210ffaa13f184d2a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Fri, 24 Jul 2009 23:28:27 +0200 Subject: Fixed: Text scroller is not UTF-8 aware (closes #146) --- HISTORY | 1 + render.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 0384f0f..913ff53 100644 --- a/HISTORY +++ b/HISTORY @@ -98,6 +98,7 @@ ____-__-__: Version 1.3 - Updated Italian language texts (thanks to Diego Pierotto / closes #153) - Fixed resetting of replay information (closes #156) - Added ReplayMode "audiocd" (thanks to Björn Sturzrehm - closes #138) +- Fixed: Text scroller is not UTF-8 aware (closes #146) 2009-06-01: Version 1.2 diff --git a/render.c b/render.c index 4cce312..09e79fd 100644 --- a/render.c +++ b/render.c @@ -505,7 +505,7 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const else if (mNow >= state.nexttime) { uint nextin = Delay; if (state.direction > 0) { - if (Font->Width(Text.c_str() + state.offset) <= Size.w) { + if (Font->Width(Text.c_str() + Utf8SymChars(Text.c_str(), state.offset)) <= Size.w) { --state.direction; nextin = 1500; } else @@ -532,7 +532,7 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const if (Bg) mScreen->DrawRectangle(Pos.x, Pos.y, Pos.x + Size.w - 1, Pos.y + Size.h - 1, *Bg); - mScreen->DrawText(Pos.x, Pos.y, Text.c_str() + state.offset, Fg ? *Fg : 0, clrTransparent, Font, + mScreen->DrawText(Pos.x, Pos.y, Text.c_str() + Utf8SymChars(Text.c_str(), state.offset), Fg ? *Fg : 0, clrTransparent, Font, Size.w, Size.h, Align); } -- cgit v1.2.3