Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turkish Characters #1880

Closed
emreires opened this issue Jun 14, 2018 · 17 comments
Closed

Turkish Characters #1880

emreires opened this issue Jun 14, 2018 · 17 comments

Comments

@emreires
Copy link

How can display turkish characters in imgui?

@ocornut
Copy link
Owner

ocornut commented Jun 14, 2018

Hello,
You need to load a font with the glyph ranges used for Turkish (I think just loading 0x0020 to 0x01FF should be enough if your have the right font).
Please read misc/fonts/README.txt (EDIT 2019: now in docs/FONTS.txt)

@emreires
Copy link
Author

I have right font but it doesnt work :/

@emreires
Copy link
Author

Can you give example source code?

@ocornut
Copy link
Owner

ocornut commented Jun 14, 2018

Apologies, I gave you the wrong answer. The right answer is: Sorry but #1586.

@ocornut ocornut closed this as completed Jun 14, 2018
@emreires
Copy link
Author

:D uh, no.

I'm not a paster or cheater.
Im doing a simple 2d game, lol

@ocornut
Copy link
Owner

ocornut commented Jun 14, 2018

Please read the documentation. If you say something doesn't work, please provide proper repro code. We can't help you if we don't know what you have tried.

  • load a font that contains turkish characters
  • when loading the font you need to specify the glyph range
  • use the style editor, inside "fonts" to confirm that the glyphs you need are loaded
  • make sure you pass utf-8 strings, which you can do in C++11 by using u8"Selam Dünya"

@drbiricik
Copy link

drbiricik commented Jul 25, 2018

Example Turkish Font Use :
Turkish Font Use

@Flix01
Copy link

Flix01 commented Jul 25, 2018

@drbiricik: Not sure if this can help you, but for all these kind of problems, I'd also make sure that all the source files I'm using are saved using the UTF8 encoding.

I don't know what's the default encoding in Turkey (probably UTF8 already) so I don't know if this can help you or not! 😒

Also I think you should add the code you're using to display the text...

@ice1000
Copy link
Contributor

ice1000 commented Jul 25, 2018

No, @Flix01 this is not related to encodings -- his encoding is correct.

@Flix01
Copy link

Flix01 commented Jul 25, 2018

@ice1000: OK then...

@drbiricik
Copy link

drbiricik commented Jul 25, 2018

Turkish characters could not be printed on the menu. Why?
Turkish Font Problem

@ocornut
Copy link
Owner

ocornut commented Jul 25, 2018 via email

@drbiricik
Copy link

it worked. thank you.

@revengecommando
Copy link

Can you give example source code?

Emre reis yapabildiysen banada kodu yazarmısın?

@emreires
Copy link
Author

Can you give example source code?

Emre reis yapabildiysen banada kodu yazarmısın?

Yardım gerekiyorsa ekleyebilirsin, anladığım kadarıyla oyun camiasındasın.
Discord: Vortéx!#3643

@emrecpp
Copy link

emrecpp commented Apr 10, 2021

static const ImWchar icons_ranges_Turkish[] = {
0x0020, 0x00FF, // Basic Latin + Latin Supplement
0x00c7, 0x00c7, // Ç
0x00e7, 0x00e7, // ç
0x011e, 0x011e, // Ğ
0x011f, 0x011f, // ğ
0x0130, 0x0130,// İ
0x0131, 0x0131, // ı
0x00d6, 0x00d6, // Ö
0x00f6, 0x00f6, // ö
0x015e, 0x015e, // Ş
0x015f, 0x015f, // ş
0x00dc, 0x00dc, // Ü
0x00fc, 0x00fc, // ü

0, };
io.Fonts->AddFontFromFileTTF("C:\Windows\Fonts\arial.ttf", 16.0f,0, icons_ranges_Turkish);
ImGui::Text((const char*)u8"\u00c7 \u00e7 \u0130 İŞÇĞ Emre Demircan github:emrecpp");

ocornut added a commit that referenced this issue May 3, 2022
…ng issues and font loading issues. Simplified code + extracted DebugNodeFontGlyph().

Helper to diagnose issues such as #4866, #3558, #3436, #2233, #1880, #1780, #905, #832, #762, #726, #609, #565, #307)
emartisoft added a commit to emartisoft/imgui-demo-with-glfw_and_opengl3 that referenced this issue May 7, 2023
@emartisoft
Copy link

if you are using vs c++ compiler than instead of u8 string literal can also use this.

#pragma execution_character_set("utf-8")
....
 ImGui::Button("Tıkla bakalım öçşiğüÖÇŞİĞÜ");
....
// from @emrecpp 
static const ImWchar icons_ranges_Turkish[] = {
0x0020, 0x00FF, // Basic Latin + Latin Supplement
0x00c7, 0x00c7, // Ç
0x00e7, 0x00e7, // ç
0x011e, 0x011e, // Ğ
0x011f, 0x011f, // ğ
0x0130, 0x0130,// İ
0x0131, 0x0131, // ı
0x00d6, 0x00d6, // Ö
0x00f6, 0x00f6, // ö
0x015e, 0x015e, // Ş
0x015f, 0x015f, // ş
0x00dc, 0x00dc, // Ü
0x00fc, 0x00fc, // ü

0, };
io.Fonts->AddFontFromFileTTF("C:\Windows\Fonts\arial.ttf", 16.0f,0, icons_ranges_Turkish);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants