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

SDF text rendering #261

Open
crolando opened this issue Oct 10, 2023 · 3 comments
Open

SDF text rendering #261

crolando opened this issue Oct 10, 2023 · 3 comments

Comments

@crolando
Copy link

Have you experimented with SDF text rendering? Or is there a way to make text more visible when the nodes are very small?

@thedmd
Copy link
Owner

thedmd commented Oct 14, 2023

To be clear I would have to say that all text rendering is done via ImGui. Node editor does not touch that.

Solution I'm using in our production code is to have two fonts with two different sizes. Now that I realized support for that was my unpublished change I made a PR which adds RasterizationDensity.

Back to solution I use. I generate two fonts, one with 100% scaling, one with 400% scalling. I pick default font based on how much canvas is zoomed in. When it is zoomed-in > 200% I use 400% font. Otherwise I use 100%.

Addressing your question directly: As an extra when view is zoomed out to avoid tons of small unreadable texts I fade them away.
I think you can try to create small font with bosted RasterizationDensity to make it more readable. Trick would work to an extent, but at some point text became to small to be readable. This is leading to the solution with fading text away.

Does this help with your case?


Support for SDF fonts is possible and can be done. Node editor itself does not impose any limitation in that matter. When in scope of this project it would be the job of example application harness to support that.

@crolando
Copy link
Author

That sounds good!

For my projects, I depend on your patched copy of imgui in your "external" folder, because that is also patched with the FringeScale feature. This might be a big ask, but can you patch the RasterizationDensity feature into your external\imgui code?

@thedmd
Copy link
Owner

thedmd commented Dec 27, 2023

external\imgui is oldes supported version if ImGui. Node Editor should work with your own copy of ImGui just fine.
I'm perdodically fixing issues when they arise.

Did you know that official ImGui repository have FringeScale merged? : )

Backport of RasterizationDensity is possible, but probably not an no-op. ImGui cleaned up atlas generation code some time ago and I expect conflicts when trying to cherry-pick those changes.

BDW. RasterizationDensity is also merged on ImGui too.

You can pick latest ImGui and cherry-pick Stack Layout PR if you're using it.

Please let me know if that does work for you.

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