-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
font and rasterization improvements for ImGui #76529
font and rasterization improvements for ImGui #76529
Conversation
Make ImGui use Roboto by default, and the Freetype rasterizer. Load both the configured gui font and the normal monospaced font for use by ImGui. Make item descriptions use the mono font for drawing ASCII artwork. Fixes CleverRaven#76420
Is there a particular reason for adding a new font to the mix, and are there any issues with including Apache licensed material in a cc-by-sa 3.0 project? |
Good questions. Yes, the reason for adding Roboto is that it is a proportional font. We could pick from quite a selection, but Roboto was ready to hand, appropriately licensed, inoffensively styled (not deliberately weird or thematic, or deliberately bad like Comic Sans, etc), and has relatively thick strokes even at small font sizes (which makes it render well even if we stick to the default STB rasterizer which cannot do any hinting). And of course the user can override the choice if they prefer something else. Apache 2.0 is completely compatible with the Creative Commons license, and it meets the definition of an Open Source license. |
I guess it builds fine on OSX. Anyone want to give it a try and make sure it works? |
Weird. It compiled just fine on Windows while it was a draft… |
It's broken at the macOS build referencing imgui so I'm assuming this isn't a random failure? |
I wish it were. It's been more than 15 years since I did any development on OSX, and I never had to dig too deep into the build system on that project. I don’t have a Windows machine either. I’d appreciate some help getting this patch to work on those platforms from anyone who has the time. I spent a little time last weekend trying to find documentation on the subject, but didn’t make much headway. I didn’t really want to spam the CI system with guesses, but on the other hand the only guess I have is to add |
@db48x I took a look. does not compile on VS2022. VS2022 does not like your usage of '__attribute__((unused))'. Instead it prefers the C++17 '[[maybe_unused]]'. If we can't use C++17 across the board, maybe consider a preprocessor definition? |
Oops, sorry about that. It looks like I fixed that last week and then just never pushed it. Must have gotten distracted. |
You’ll need to pick a font that actually has the appropriate characters for your chosen language. It should also have glyphs for ASCII characters, or we’ll be forced to use the fallback path for them.
Nobody could say with a straight face that this is better. Especially the two blank lines between every function.
686bde5
to
fe9d67a
Compare
Crap I misread this and thought it was no longer breaking Mac builds. |
Summary
Interface "use Freetype to render fonts for ImGui, and use multiple fonts in the ImGui interface"
Purpose of change
Make ImGui use Roboto by default, and the Freetype rasterizer. Load both the configured gui font and the normal monospaced font for use by ImGui. Make item descriptions use the mono font for drawing ASCII artwork. Configure hinting so that Terminus and unifont don’t look awful.
Fixes #76420
Testing
Check out the artwork for a pistol or something.
Additional context
This is a draft for a reason: I need someone who builds on Windows and/or Mac to give me the right CFLAGS/LDFLAGS for linking against Freetype2