ImGui.NET icon indicating copy to clipboard operation
ImGui.NET copied to clipboard

Russian letters

Open iocmet opened this issue 4 years ago • 20 comments

I want to make an interface with Russian text but... devenv_yT62OQUzja Terraria_NUrQuXA1wK

iocmet avatar Aug 25 '21 16:08 iocmet

You have to create the font texture using ImFontAtlas and providing glyph ranges you want to use (there's a helper method GetGlyphRangesCyrillic that could suit you). The default font contains ascii chars only.

dpethes avatar Aug 28 '21 05:08 dpethes

I am also trying to solve this issue ( trying to add Chinese chars for my users ). Let me know if there are any ImGui/ImGui.NET issue I should look at or any code that does this. It doesn’t matter if the code is in c# or c++

zaafar avatar Sep 10 '21 16:09 zaafar

I have finally updated my lib to support custom fonts (English/non-English) loading at run-time (between render frames). Feel free to use it as a reference & close this issue. https://github.com/zaafar/ClickableTransparentOverlay

zaafar avatar Nov 20 '21 17:11 zaafar

hi i added custom font and glyphs... but russian text keeps turning into question marks image image image

iocmet avatar Jun 10 '22 01:06 iocmet

Currently i use ImGuiNative.ImFontAtlas_GetGlyphRangesCyrillic(io.FontAtlas.Native) but russian characters keep turning into question marks :(

iocmet avatar Jun 10 '22 01:06 iocmet

just uploading the fonts isn't enough, you have to also select them.

zaafar avatar Jun 10 '22 01:06 zaafar

i selected it

iocmet avatar Jun 10 '22 02:06 iocmet

image image

iocmet avatar Jun 10 '22 02:06 iocmet

i replaced default imgui font with custom

iocmet avatar Jun 10 '22 02:06 iocmet

image what i doing...

iocmet avatar Jun 10 '22 02:06 iocmet

it not work... how to concatenate imgui cyrillic glyph ranges and ranges in b variable?

iocmet avatar Jun 10 '22 02:06 iocmet

Modifying proggyclean.ttf on the file system will not help since proggyclean is embedded into ImGui code. You have to upload a new one and select it.

zaafar avatar Jun 10 '22 02:06 zaafar

before that I tried to use a font with russian characters and it gives the same result

iocmet avatar Jun 10 '22 02:06 iocmet

wait app runs

iocmet avatar Jun 10 '22 02:06 iocmet

image image i forgot change size sorry it looks really bad

iocmet avatar Jun 10 '22 02:06 iocmet

I think I should somehow make it clear to imgui so that he uses utf8? for example in c++ i need to use u8"some russian text"

iocmet avatar Jun 10 '22 02:06 iocmet

image my atlas texture

iocmet avatar Jun 10 '22 02:06 iocmet

and how to get font? ImGui.GetIO().FontAtlas.Fonts[0] throws nullreferenceexception and ImGui.GetIO().FontAtlas.Size bigger than 1000...

iocmet avatar Jun 10 '22 02:06 iocmet

image image

iocmet avatar Jun 10 '22 02:06 iocmet

image it not work image

iocmet avatar Jun 10 '22 04:06 iocmet

@iocmet have u solved this issue?

Mi1ax avatar Nov 03 '22 20:11 Mi1ax

No

iocmet avatar Nov 03 '22 20:11 iocmet

Okay, I found a solution ImGui.GetIO().Fonts.AddFontFromFileTTF("Assets/Fonts/RobotoMono-Regular.ttf", 22, null, fonts.GetGlyphRangesCyrillic()); It's works perfectly Screenshot 2022-11-03 at 23 54 56

Mi1ax avatar Nov 03 '22 20:11 Mi1ax

Found the answer here -> https://github.com/ocornut/imgui/issues/307#issuecomment-134546806

Mi1ax avatar Nov 03 '22 20:11 Mi1ax

Thanks i try use it later

iocmet avatar Nov 03 '22 20:11 iocmet

image Still not work for me :(

iocmet avatar Nov 29 '22 21:11 iocmet

image image

iocmet avatar Nov 29 '22 21:11 iocmet

Finnaly fixed! The problem was my way to get WM_CHAR message, it not works with cyrillic symbols, now i changed it and fixed some other bug and now i can type cyrillic latters! image

iocmet avatar Dec 10 '22 14:12 iocmet

6{F1XG9_BQS7LH~M59RZTK Display Russian

xinc6 avatar Apr 06 '23 04:04 xinc6

Can you show how you achieve this?

krulci avatar May 29 '23 17:05 krulci