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

Highlight TextArea cursor bug #338

Closed
fgnm opened this issue Aug 29, 2020 · 1 comment
Closed

Highlight TextArea cursor bug #338

fgnm opened this issue Aug 29, 2020 · 1 comment

Comments

@fgnm
Copy link
Contributor

fgnm commented Aug 29, 2020

I've found another bug in HighlightTextArea. Highlighted text seams cause a visual bug in the cursor that is not able to determine the correct position of a single char.
In this GIF you can see the bug in Test Application when many words are highlighted on the same line:

highlight_bug

Not sure to what is related, because in the code I can see just font.setColor and font.draw nothing that should change char width. Here it's clear that the highlighted a is different:
immagine immagine

I've found also a workaround (for to my use case and my font type) using setFixedWidthGlyphs in BitmapFont:

BitmapFont defaultMono = monoGenerator.generateFont(parameter);
defaultMono.setFixedWidthGlyphs(parameter.characters);
@kotcrab
Copy link
Owner

kotcrab commented Aug 30, 2020

Duplicate of #306, this shouldn't happen with monospaced font. Though I don't why why you would still need to call setFixedWidthGlyphs even when using monospaced font.

Looks like this is an issue with kerning. X offset of highlight is calculated only on the highlighted text itself while cursor is using glyph positions calculated on the entire text. Unfortunately I'm not seeing an easy fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants