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

Any way to set font for individual widgets or windows? #104

Open
StrikerMan780 opened this issue Sep 13, 2024 · 4 comments
Open

Any way to set font for individual widgets or windows? #104

StrikerMan780 opened this issue Sep 13, 2024 · 4 comments

Comments

@StrikerMan780
Copy link
Contributor

StrikerMan780 commented Sep 13, 2024

Just wondering if there's a way to set the font for individual widgets in a window, or for a whole window, and if not, is it alright if I request this as a feature?

@StrikerMan780 StrikerMan780 changed the title Any way to set font for individual items or windows? Any way to set font for individual widgets or windows? Sep 13, 2024
@RobLoach
Copy link
Owner

Possibly could accomplish having different color styles by having a pointer to a style for each widget, and apply it to the Nuklear styles when rendering.

Not sure how to have different fonts displayed in the same context though. Have you done this before?

@StrikerMan780
Copy link
Contributor Author

StrikerMan780 commented Sep 13, 2024

Yes. You can push/pop fonts in Nuklear, (nk_style_push/pop_font)

I've used it in my own menus before. For example, to use different fonts for the title and menu itself. Like so:

image

(It's meant to mimic the look of the original Terminal Velocity menu, but a bit more streamlined)

Another way is to use nk_style_set_font, which sets it directly, but clears the push/pop stack.

@RobLoach
Copy link
Owner

Looks great! Does look like the original. Something like this should allow setting a different font on a per-widget basis, but I'm unsure it's the best design. Also, would love a demonstration of using them in the demos #107

@StrikerMan780
Copy link
Contributor Author

StrikerMan780 commented Sep 14, 2024

I mean, that would do the trick. Looks good to me, but I'm also no expert so I can't really judge the design.

There's also nk_style_push/pop_style_item, which would let you set style stuff in general per-widget. Dunno how best you'd write an API for that in nuklear_console, but might be something worth considering.

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