Skip to content

Commit

Permalink
GUI: Fix #11767
Browse files Browse the repository at this point in the history
This is an attempt to fix ellipsifying of text in STARK by changing
width and bounding box calculation discrepancy in recently introduced
handleEllipsis() and getBoundingBoxImpl().
  • Loading branch information
GeorgeSapkin committed Oct 16, 2020
1 parent 034ff75 commit 6c42908
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions graphics/font.cpp
Expand Up @@ -52,8 +52,7 @@ Common::Rect getBoundingBoxImpl(const Font &font, const StringType &str, int x,
x = x + w - width;
x += deltax;

bool first = true;
Common::Rect bbox;
Common::Rect bbox(x, y, x + width, y);

typename StringType::unsigned_type last = 0;
for (typename StringType::const_iterator i = str.begin(), end = str.end(); i != end; ++i) {
Expand All @@ -66,12 +65,7 @@ Common::Rect getBoundingBoxImpl(const Font &font, const StringType &str, int x,
break;
if (x + charBox.right >= leftX) {
charBox.translate(x, y);
if (first) {
bbox = charBox;
first = false;
} else {
bbox.extend(charBox);
}
bbox.extend(charBox);
}

x += font.getCharWidth(cur);
Expand Down

0 comments on commit 6c42908

Please sign in to comment.