diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.cpp b/src/apps/haiku-depot/textview/ParagraphLayout.cpp index 107a606b3e..86f30c2599 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.cpp +++ b/src/apps/haiku-depot/textview/ParagraphLayout.cpp @@ -628,7 +628,7 @@ ParagraphLayout::_Layout() } // The last line may not have been appended and initialized yet. - if (lineStart <= glyphCount - 1) { + if (lineStart <= glyphCount - 1 || glyphCount == 0) { float lineHeight; _FinalizeLine(lineStart, glyphCount - 1, lineIndex, y, lineHeight); } @@ -867,6 +867,15 @@ ParagraphLayout::_FinalizeLine(int lineStart, int lineEnd, int lineIndex, } } + if (fGlyphInfos.CountItems() == 0 && fTextSpans.CountItems() > 0) { + // When the layout contains no glyphs, but there is at least one + // TextSpan in the paragraph, use the font info from that span + // to calculate the height of the first LineInfo. + const TextSpan& span = fTextSpans.ItemAtFast(0); + line.layoutedSpans.Add(span); + _IncludeStyleInLine(line, span.Style()); + } + lineHeight = line.height; return fLineInfos.Add(line);