haskell-game / dear-imgui.hs

Haskell bindings to Dear ImGui, an immediate mode GUI toolkit
BSD 3-Clause "New" or "Revised" License
142 stars 31 forks source link

Font glyph ranges support #113

Closed chekoopa closed 2 years ago

chekoopa commented 2 years ago

Stumbled upon the library on this week and pleased that it fits nicely for NixOS-based development and deploy. The problem is our intended end-users are Russian-speaking, and ImGui supposedly supports Unicode fonts. However, we should explicitly set needed character ranges, otherwise they would be replaced with ?'s.

So, I propose expanding font binds and adding glyph_ranges option, if not also ImFontConfig. Though, it seems that the issue is actually linked with #61.

dpwiz commented 2 years ago

Raw.addFontFromFileTTF should definitely get its remaining arguments.

With the amount of stuff operating on fonts I think all the GetIO().Fonts functions should be evicted into DearImgui.Raw.Fonts, together with atlas and range builder handles/methods.

chekoopa commented 2 years ago

I'm trying to grasp on C++ FFI and implement glyph_ranges (would like utilize both data GlyphRanges = GlyphRanges (Ptr ImWchar) and ImFontGlyphRangesBuilder, though) and ImFontConfig. Though, I can't think of good interface to get/set particular parameters. Like, I can't come up with a sensible list of struct fields to be changed and really think of some record type with struct conversion. Thus, some Haskell&C++ advice is very welcome here.

dpwiz commented 2 years ago

You can submit a PR and we'll get it in shape there.