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

Selected text has incorrect background colour when an SDF font is used #1134

Open
nixbody opened this issue Feb 25, 2023 · 3 comments
Open

Comments

@nixbody
Copy link

nixbody commented Feb 25, 2023

There seems to be some problem with SignedDistanceField shader which causes selected text to have the same background colour as is set as text colour. That makes the selected text ureadable because it just blends with the background. Setting TextInput.selectionTile manually has no effect with SDF fonts.

@nixbody
Copy link
Author

nixbody commented Mar 1, 2023

This only seems to happen when I call hxd.res.BitmapFont.toSdfFont() with h2d.Font.SDFChannel.Alpha (which is needed for SDF fonts generated by Hiero).

@leland-kwong
Copy link

Thanks for pointing this out, thought I was using it wrong. As a workaround I just use a non-sdf font for the text input which I don't think should be a huge deal since text inputs don't generally have large blocks of text so super-crisp fonts aren't that important.

@nixbody
Copy link
Author

nixbody commented Mar 20, 2025

To generate SDF fonts instead of Hiero you can use Fontgen which uses RGB instead of alpha channel, and then selection colour is calculated correctly. It's Windows-only but it works in Wine.

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

No branches or pull requests

2 participants