You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple corner cases where MOAITextLabel:getTextBounds doesn't work as expected. I've tested those with the override that takes a start and an end index, but they should behave identically for the simple version.
If the string has trailing spaces, the returned rectangle doesn't include those spaces but ends at the last visible glyph.
If the string has leading spaces, no valid rectangle is returned at all.
If the start index is one greater than the end index, this should describe a zero-length interval. Accordingly, I'd expect a zero-width rectangle that represents a vertical line between two characters.
These cases may seem contrived, but they all come into play as soon as you try to display a text cursor at a specific position within a string. All but the last one (for which I found a workaround) can be observed as unexpected behavior in the sample samples/input-text (pull request #1060).
The text was updated successfully, but these errors were encountered:
If the string has trailing spaces, the returned rectangle doesn't include those spaces but ends at the last visible glyph./If the string has leading spaces, no valid rectangle is returned at all.
IMHO, this is a bug more than a corner case, as spaces should have their own glyph, and thus geometry, indeed.
There are multiple corner cases where
MOAITextLabel:getTextBounds
doesn't work as expected. I've tested those with the override that takes a start and an end index, but they should behave identically for the simple version.These cases may seem contrived, but they all come into play as soon as you try to display a text cursor at a specific position within a string. All but the last one (for which I found a workaround) can be observed as unexpected behavior in the sample
samples/input-text
(pull request #1060).The text was updated successfully, but these errors were encountered: