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:
Stephan Aßmus 2013-09-06 15:48:30 +02:00
parent 8a1f303840
commit 720f7fdf54

View File

@ -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,6 +729,9 @@ ParagraphLayout::_DrawSpan(BView* view, BPoint offset,
delta.space = line.extraWhiteSpacing;
// TODO: Fix in app_server: First glyph should not be shifted by delta.
if (text[0] == ' ')
offset.x -= delta.space;
else
offset.x -= delta.nonspace;
view->DrawString(span.Text(), offset, &delta);