Closed vitalline closed 4 years ago
Chinese characters used to work for me. Can you reproduce this in pure C++?
I cannot, even though I was sure it happened to me before when I was working with C++ ImGui. I can send you a reproducible Java example. See if that helps. example.zip
Do you understand how the u8"bla"
things work in C++? How does it convert your string into utf8 sequences? Is your Java source code UTF-8-encoded?
u8
literal, but it worked as normal both with the literal and without it.Is this what you've expected?
Yes, that is exactly what I expected.
Yes. Both Notepad++ and HxD confirm that.
You should compile your Java source as UTF-8, in addition to ensuring your Java source is UTF-8 encoded. Here's how:
compileJava.options.encoding = 'UTF-8'
If you're willing to help document this, please pull request me! So other people like you can save time.
Alright, thanks! Should I add a note to README.md
, or document it inside JImFont.java
/JImFontAtlas.java
?
Probably README
Done.
Hi,
I'm having a problem with selecting glyphs to load — the procedure takes glyph ranges, but no range provided by getGlyphRangesFor*()
is suitable for me and I do not see a way to create them through the API. Is it possible?
Hi,
I'm having a problem with selecting glyphs to load — the procedure takes glyph ranges, but no range provided by
getGlyphRangesFor*()
is suitable for me and I do not see a way to create them through the API. Is it possible?
It is, but I haven't yet adapted the API for custom ranges. It's hard in general -- imagine you passes a two-dim array from Java to C++. There are some design choices to be made.
Btw, I suggest opening new issue. @seb321
When using Unicode characters (such as Cyrillic letters) in JImGui widgets, they are displayed in native encoding. For example, on Windows 10 (with Russian locale), after adding Cyrillic font ranges to font atlas, calling
text("Шахматы")
displaysШахматы
(UTF-8 representation of "Шахматы" incorrectly read as a CP1251 string). I'm assuming that the string's encoding is by default interpreted as a Unicode in the Java bindings, but as the system default encoding in ImGui's C++ implementation.