Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
Other
9.28k stars 564 forks source link

Handling fonts #20

Open Nielsbishere opened 4 years ago

Nielsbishere commented 4 years ago

Currently not useful for me yet; but could potentially be an issue for other people or in the future. If someone wants multiple fonts per text field or object, they'd have to set it per context as far as I've seen. Is there no better option? Like being able to specify parts of text that use different fonts?

samadadi commented 4 years ago

I am sorry that I ask this question in here but I have to. It's almost two days that I want to load my custom ".ttf" font from file without third party library like (sdl, glfw, ...) but I could not do this and I looked at demo examples in project repository but as I said non of them have used just nuklear to load font. So I wonder if I should use those libraries to work with fonts and generally with nuklear itself?

dumblob commented 4 years ago

@samadadi yes, Nuklear is designed to support that - will this wiki help? We migrated the repo here, but didn't have time to migrate wiki yet - feel free to do that :wink:.

ghost commented 4 years ago

Like being able to specify parts of text that use different fonts?

This would require meta data to be appended to strings. Such a change carries too much weight and would complicate the API. I have the same wish as well however. I mix a lot of font sizes in my UI, especially for icons and emojis. Constantly switching fonts is a pain, so I made a bunch of macros to specify Emoji and Icon sizes inside my code for easier reading. Of course none of this works inside of nuklear objects, so copy pasting a bunch nk_label it is.