pthom / imgui_bundle

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!
https://pthom.github.io/imgui_bundle/
MIT License
592 stars 63 forks source link

How to add colored glyphs or emojis? #161

Closed ShaiAvr closed 6 months ago

ShaiAvr commented 6 months ago

I want to create text with emojis and colored glyphs with ImGui. I tried to follow the instructions of imgui, but couldn't get it to work. Specifically, I couldn't find the ImGuiFreeTypeBuilderFlags_LoadColor flag. Can you show how to include emojis in text? I also think it's a good idea to add an example on how to that in the demos. It's a nice feature for modern applications and I want to use it in my project.

pthom commented 6 months ago

Hi,

At the moment, imgui is not compiled with Freetype support inside imgui bundle, and thus it cannot support colored emojis.

A possible improvement in the future, but it would require two additional dependencies (Freetype + lunasvg), and that makes it a bit hard.

pthom commented 6 months ago

As I supposed, adding support for Freetype and make it multiplatform was hard, and took a lot of work.

However, you now can use colored fonts:

See API, example usage in code, and online demo

However, beware, Freetype does not support all Emoji Colored fonts

ShaiAvr commented 6 months ago

@pthom Cool. Can't wait for the next release on PyPi. I think I'll close this issue for now.