Closed bigorange558 closed 5 years ago
Hi, I'm glad this small library can be useful for you and your project!
Can you please provide a screenshot of how it is rendered in your software?
Also, is that C++ standard string? if yes, I recommend using c_str
instead of data
.
Keep me updated.
Thank you very much for your reply!I tried the c_str,but still the same as before.
I'm using the string type :
typedef basic_string<char, char_traits
Forgot to say,My email is: bigorange923@gamil.com
If you are convenient, you can send me your email address, I will send you a simple demo project file ,You probably know what went wrong.Thank you!
Interesting... I would like to know more about this, I will send you an email so I can get more information about this issue and fix it as soon as possible.
Sorry, I entered the wrong mailbox suffix. it's:bigorange923@gmail.com I am a careless person and need to get rid of these bad habits as soon as possible ~~~
By looking at your code, I realized you are using GetGlyphRangesDefault
while adding a font, which doesn't contain Farsi/Arabic glyph ranges
In order to achieve this:
You have to declare glyph ranges you want to use. For example:
static const ImWchar ranges[] =
{
0x0020, 0x00FF, // Basic Latin
0x2010, 0x205E, // Punctuations
0x0600, 0x06FF, // Farsi/Arabic
0xFE00, 0xFEFF, // Farsi/Arabic
0,
};
And then, while you're adding a new font, you should pass a reference of ranges
.
For example:
io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\tahomabd.ttf", 15.0f, NULL, &ranges[0]);
Hope I helped you. I guess I should do a how-to for ImGUI users when they want to use FarsiType!
This time it worked, hahaha, I have no way to study for 3 days. Your technique is so good, it will help me solve it so soon, thank you very much! !
I’m glad it works! so I guess its okay to close this issue now. Good luck
Of course, this problem has been solved very well, thank you very much, keep in touch.
Hi, you need to add the 'bold row' to solve the problem with گچپژ
static const ImWchar ranges[] = {
0x0020, 0x00FF, // Basic Latin
0x2010, 0x205E, // Punctuations
0x0600, 0x06FF, // Farsi/Arabic
0xFB50, 0xFBFF, // Farsi/Arabic
0xFE00, 0xFEFF, // Farsi/Arabic
0,
};
The reason is that without the row, the following rows of your vector will be useless:
const std::vector<std::vector
I see, thanks for noticing that missing range! @mscmajidGit
🙏🏻
I see, thanks for noticing that missing range! @mscmajidGit
🙏🏻
salam bro Amyr i have real big problems arabic text with imgui, every arabic letter show it '?' with your process and without it, i am using android and i am try using your source but its not working with me can u help me please? and that my code
ImFontConfig cfg; cfg.FontDataOwnedByAtlas = false; cfg.SizePixels = ((float) density / 20.0f);
static const ImWchar ranges[] = { 0x0020, 0x00FF, // Basic Latin 0x2010, 0x205E, // Punctuations 0x0600, 0x06FF, // Farsi/Arabic 0xFE00, 0xFEFF, // Farsi/Arabic 0, };
std::string Path = "system/fonts/DancingScript-Bold.ttf"; font1 = io.Fonts->AddFontFromFileTTF(Path.c_str(), ((float) density / 20.0f), &cfg, &ranges[2]); std::string s= u8"السلام عليكم"; std::string s1 =FarsiType::ConvertToFAGlyphs(s); ImGui::Begin(s1.c_str(), 0, ImGuiWindowFlags_NoSavedSettings);
thanks bro its working with me!!! thankyou for really nice tool!
you're welcome, sorry for late response @SafuIraq I assume it was a problem with your font and you changed it, tell us how you fixed it so if someone else came across this issue they can figure it out as well
Thank you very much for your code, which is very important to our team。 But we encountered some minor problems during use. I set the parameters like this: string s= u8"مرحبا"; string s1 =FarsiType::ConvertToFAGlyphs(s); ImGui::Begin(s1.data(), &g_continue_pro, ImGuiWindowFlags_NoResize); This setting can't be displayed normally.I don't know what the problem is. When you are not too busy, you can help me look at it.Thanks again!