BControlLook::DrawLabel(): Fix off-by-one error
* BFont::TruncateString() expects a pixel count (as opposed to a pixel distance). That would cause a tightly fitting string to be truncated. * Round the result of StringWidth() to avoid drawing at a non-integer location.
This commit is contained in:
parent
fe8787698c
commit
6af520e2a9
|
@ -1889,7 +1889,7 @@ BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
|||
}
|
||||
|
||||
// label, possibly with icon
|
||||
float availableWidth = rect.Width();
|
||||
float availableWidth = rect.Width() + 1;
|
||||
float width = 0;
|
||||
float textOffset = 0;
|
||||
float height = 0;
|
||||
|
@ -1908,7 +1908,7 @@ BControlLook::DrawLabel(BView* view, const char* label, const BBitmap* icon,
|
|||
view->GetFont(&font);
|
||||
|
||||
font.TruncateString(&truncatedLabel, B_TRUNCATE_END, availableWidth);
|
||||
width += font.StringWidth(truncatedLabel.String());
|
||||
width += ceilf(font.StringWidth(truncatedLabel.String()));
|
||||
|
||||
font_height fontHeight;
|
||||
font.GetHeight(&fontHeight);
|
||||
|
|
Loading…
Reference in New Issue