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

WIP font stuff for ImGui #76529

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

db48x
Copy link
Contributor

@db48x db48x commented Sep 18, 2024

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

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
@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. Code: Build Issues regarding different builds and build environments [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Sep 18, 2024
@harakka
Copy link
Contributor

harakka commented Sep 19, 2024

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?

@db48x
Copy link
Contributor Author

db48x commented Sep 19, 2024

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.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 19, 2024
@db48x
Copy link
Contributor Author

db48x commented Sep 20, 2024

I guess it builds fine on OSX. Anyone want to give it a try and make sure it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Build Issues regarding different builds and build environments ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properly hint text and improve font rendering.
2 participants