replaced "..." with ellipsis char

This commit is contained in:
thrust26 2017-11-21 11:01:32 +01:00
parent 8379b0af1a
commit 7a65a4445b
1 changed files with 3 additions and 2 deletions

View File

@ -213,6 +213,7 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
uInt32 color, TextAlignment align, uInt32 color, TextAlignment align,
int deltax, bool useEllipsis) int deltax, bool useEllipsis)
{ {
const string ELLIPSIS = "\x1d"; // "..."
const int leftX = x, rightX = x + w; const int leftX = x, rightX = x + w;
uInt32 i; uInt32 i;
int width = font.getStringWidth(s); int width = font.getStringWidth(s);
@ -226,7 +227,7 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
// What is best really depends on the context; but unless we want to // What is best really depends on the context; but unless we want to
// make this configurable, replacing the middle probably is a good // make this configurable, replacing the middle probably is a good
// compromise. // compromise.
const int ellipsisWidth = font.getStringWidth("..."); const int ellipsisWidth = font.getStringWidth(ELLIPSIS);
// SLOW algorithm to remove enough of the middle. But it is good enough for now. // SLOW algorithm to remove enough of the middle. But it is good enough for now.
const int halfWidth = (w - ellipsisWidth) / 2; const int halfWidth = (w - ellipsisWidth) / 2;
@ -244,7 +245,7 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
// At this point we know that the first 'i' chars are together 'w2' // At this point we know that the first 'i' chars are together 'w2'
// pixels wide. We took the first i-1, and add "..." to them. // pixels wide. We took the first i-1, and add "..." to them.
str += "..."; str += ELLIPSIS;
// The original string is width wide. Of those we already skipped past // The original string is width wide. Of those we already skipped past
// w2 pixels, which means (width - w2) remain. // w2 pixels, which means (width - w2) remain.