Closed kiith-sa closed 10 years ago
Hmm.. Forcing to use string
means the user has to either allocate on each render or do an unsafe cast (char[] to string for example) if they want to render some frequently updated piece of text.
Since imgui is an immediate mode GUI lib it makes sense that it takes non-immutable data methinks.
IIRC imgui did have some unicode support somewhere, or maybe imgui is based on some fork which used to have unicode support. Maybe I'm remembering it wrong though. Anyway this looks like great work so far, thank you!
The main reason I used string
is that in D it's 'obvious'/self-documenting that string
is UTF-8. But makes sense, const(char)[]
is compatible both with string
and char[]
, we just need to specify in the docs that it's UTF-8, not ASCII.
Update:
(ping)
Woops! Sorry, I was busy with the whole "adjust to living in another country" period. :P
I'll get to your pull in a few days, promise!
Thanks for this work. If you want I could add you as a maintainer if you want to do further work on the project.
It's likely I'll have more additions in the future but it'll be solely on a I-need-this-feature-now/it's-too-slow basis (the latter is pretty much certain), so I'm not sure if I'm the right person to be a maintainer.
I added (limited) Unicode support (need to support diacritics in my project).
Changes:
string
passed instead ofconst(char)[]
for strings that will be rendered in the GUIimguiInit()
has an optionalfontTextureSize
parameter. Users of less common Unicode characters, especially CJK, may need to tweak these. (that said, imgui doesn't really support CJK anyway)Internals:
The default font texture size is overkill to ensure there are no problems for ASCII, various latin characters with diacritics and Cyrillic, but e.g. CJK users would need to increase it.