Tooltips are misaligned

I’ve just noticed that all my tooltips are misaligned. They’re set to centred, but only the last line is placed right. All the rest is shifted some pixels to the left. I think the newlines possibly added when making the layout are being counted. I can’t really follow all the stuff in TextLayout.cpp, but if I swap the parts of this conditional


so that it becomes
if (t.isWhitespace || t.isNewLine)
{
    ++charPosition;
}
else if (newGlyphs.size() > 0)
{
    // etc
}

it gets fixed. Not sure if it’s the right fix though.

Ok it’s not any added newlines, it’s just the spaces after each last word. I still can’t get my head around TextLayout, but I can’t see how the check for whitespace would be reached at the else when all spaces are separate tokens with newGlyphs.size() == 1.
tooltip


This is from the widgets demo, with some keysmashes added to make it multiline. It’s using native layout through DirectWrite, so TokenList::createLayout is not involved… There’s a difference though -the last line is shifted too.

Any clue? I’ll keep my edit for now, but it doesn’t seem like the right fix…

No one has seen this before? It’s worsened in my case by using a monospaced font, but still… I’m not even sure if it’s normal behaviour and I’m doing something wrong.

Any chance this gets a look?