Stippi + zooey:
* fixed LineHeight() for the case when the textview does not yet contain anything - instead of returning 0 we now return the lineheight of the default style (or the textview's font). Fixes #2231 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28194 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9b0eb8c8f4
commit
9f3fce1eac
@ -1969,7 +1969,21 @@ BTextView::LineWidth(int32 lineNum) const
|
||||
float
|
||||
BTextView::LineHeight(int32 lineNum) const
|
||||
{
|
||||
return TextHeight(lineNum, lineNum);
|
||||
float lineHeight = TextHeight(lineNum, lineNum);
|
||||
if (lineHeight == 0.0) {
|
||||
// We probably don't have text content yet. Take the initial
|
||||
// style's font height or fall back to the plain font.
|
||||
const BFont* font;
|
||||
fStyles->GetNullStyle(&font, NULL);
|
||||
if (font == NULL)
|
||||
font = be_plain_font;
|
||||
|
||||
font_height fontHeight;
|
||||
font->GetHeight(&fontHeight);
|
||||
// This is how the height is calculated in _RecalculateLineBreaks().
|
||||
lineHeight = ceilf(fontHeight.ascent + fontHeight.descent) + 1;
|
||||
}
|
||||
return lineHeight;
|
||||
}
|
||||
|
||||
|
||||
@ -2734,19 +2748,6 @@ BTextView::_ValidateLayoutData()
|
||||
CALLED();
|
||||
|
||||
float lineHeight = ceilf(LineHeight(0));
|
||||
if (lineHeight == 0.0) {
|
||||
// We probably don't have text content yet. Take the initial
|
||||
// style's font height or fall back to the plain font.
|
||||
const BFont* font;
|
||||
fStyles->GetNullStyle(&font, NULL);
|
||||
if (font == NULL)
|
||||
font = be_plain_font;
|
||||
|
||||
font_height fontHeight;
|
||||
font->GetHeight(&fontHeight);
|
||||
// This is how the height is calculated in _RecalculateLineBreaks().
|
||||
lineHeight = ceilf(fontHeight.ascent + fontHeight.descent) + 1;
|
||||
}
|
||||
TRACE("line height: %.2f\n", lineHeight);
|
||||
|
||||
// compute our minimal size
|
||||
|
Loading…
Reference in New Issue
Block a user