Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOAITextLabel:getTextBounds corner cases #1063

Open
DanielSWolf opened this issue Jan 6, 2015 · 2 comments
Open

MOAITextLabel:getTextBounds corner cases #1063

DanielSWolf opened this issue Jan 6, 2015 · 2 comments
Labels

Comments

@DanielSWolf
Copy link
Contributor

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).

@seclorum
Copy link
Contributor

seclorum commented Jan 7, 2015

  • 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.

@mohaalak
Copy link

mohaalak commented Mar 2, 2015

I encounter this bug when I was creating TextLable in Hannape .you can not have a text label that it's text is empty or just spaces.

@halfnelson halfnelson added the Bug label Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants