Skip to content

Commit

Permalink
Fix cUnicodeFont::shortenStringToSize with utf-8.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Jan 22, 2024
1 parent 81f6a13 commit c615222
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/output/video/unifonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ int cUnicodeFont::drawWithBreakLines (SDL_Rect rDest, const std::string& text, e

// delete as many chars as it is needed to fit into the line
while (getTextWide (stringPart, fonttype) + getTextWide ("-", fonttype) > rDest.w)
stringPart.erase (stringPart.length() - 1, 1);
utf8::pop_back (stringPart);
stringPart += "-";

// show the part of the word
Expand Down Expand Up @@ -881,7 +881,7 @@ std::string cUnicodeFont::shortenStringToSize (const std::string& str, int size,
{
while (getTextWide (res + ".", fonttype) > size)
{
res.erase (res.length() - 1, res.length());
utf8::pop_back (res);
}
res += ".";
if (cSettings::getInstance().isDebug())
Expand Down

0 comments on commit c615222

Please sign in to comment.