mirror of
https://review.haiku-os.org/haiku
synced 2025-01-20 21:41:28 +01:00
HaikuDepot: ParagraphLayout: Fix work around
* Bail early if the TextSpan length is 0. * When the span starts with a space, the work around for the app_server bug, which I should fix, needs to offset by the other delta.
This commit is contained in:
parent
8a1f303840
commit
720f7fdf54
@ -707,6 +707,10 @@ void
|
||||
ParagraphLayout::_DrawSpan(BView* view, BPoint offset,
|
||||
const TextSpan& span, int32 textOffset) const
|
||||
{
|
||||
const BString& text = span.Text();
|
||||
if (text.Length() == 0)
|
||||
return;
|
||||
|
||||
const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset);
|
||||
const LineInfo& line = fLineInfos.ItemAtFast(glyph.lineIndex);
|
||||
|
||||
@ -725,7 +729,10 @@ ParagraphLayout::_DrawSpan(BView* view, BPoint offset,
|
||||
delta.space = line.extraWhiteSpacing;
|
||||
|
||||
// TODO: Fix in app_server: First glyph should not be shifted by delta.
|
||||
offset.x -= delta.nonspace;
|
||||
if (text[0] == ' ')
|
||||
offset.x -= delta.space;
|
||||
else
|
||||
offset.x -= delta.nonspace;
|
||||
|
||||
view->DrawString(span.Text(), offset, &delta);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user