AmyrAhmady / FarsiType

FarsiType - type in Farsi or Arabic in C++ programs and get a fixed version of it!
MIT License
40 stars 8 forks source link

Fix (const std::vector<std::vector<std::string>> fa_AlphabetsAllForms) not compiling on c++20 #9

Closed oscar7070 closed 5 months ago

oscar7070 commented 6 months ago

Needs to be changed to this:

const std::vector<std::vector> fa_AlphabetsAllForms = { {"\u0623", "\ufe83", "\u0623", "\ufe84", "\ufe84"}, // faa_ALEF_HAMZEH_ABOVE, // أ {"\u0627", "\ufe8d", "\u0627", "\ufe8e", "\ufe8e"}, // faa_ALEF, // ا {"\u0622", "\ufe81", "\u0622", "\ufe82", "\ufe82"}, // faa_ALEF_MAD_ABOVE, // آ {"\u0621", "\ufe80", "\u0621", "\u0621", "\u0621"}, // faa_HAMZA, // ء {"\u0624", "\ufe85", "\u0624", "\ufe86", "\ufe86"}, // faa_VAAV_HAMZEH_ABOVE, // ؤ {"\u0625", "\ufe87", "\u0625", "\ufe88", "\ufe88"}, // faa_ALEF_HAMZEH_BELOW, // إ {"\u0626", "\ufe89", "\ufe8b", "\ufe8c", "\ufe8a"}, // faa_YEH_HAMZEH_ABOVE, // ئ {"\u0628", "\ufe8f", "\ufe91", "\ufe92", "\ufe90"}, // faa_BEH, // ب {"\u067e", "\ufb56", "\ufb58", "\ufb59", "\ufb57"}, // faa_PEH, // پ {"\u062A", "\ufe95", "\ufe97", "\ufe98", "\ufe96"}, // faa_TEH, // ت {"\u0629", "\ufe93", "\u0629", "\u0629", "\ufe94"}, // faa_TEH_TANIS, // ة {"\u062b", "\ufe99", "\ufe9b", "\ufe9c", "\ufe9a"}, // faa_SEH, // ث {"\u062c", "\ufe9d", "\ufe9f", "\ufea0", "\ufe9e"}, // faa_JEEM, // ج {"\u0686", "\ufb7a", "\ufb7c", "\ufb7d", "\ufb7b"}, // faa_CHEH, // چ {"\u062d", "\ufea1", "\ufea3", "\ufea4", "\ufea2"}, // faa_HEH_JEEMY, // ح {"\u062e", "\ufea5", "\ufea7", "\ufea8", "\ufea6"}, // faa_KHEH, // خ {"\u062f", "\ufea9", "\u062f", "\ufeaa", "\ufeaa"}, // faa_DAAL, // د {"\u0630", "\ufeab", "\u0630", "\ufeac", "\ufeac"}, // faa_ZAAL, // ذ {"\u0631", "\ufead", "\u0631", "\ufeae", "\ufeae"}, // faa_REH, // ر {"\u0632", "\ufeaf", "\u0632", "\ufeb0", "\ufeb0"}, // faa_ZEH, // ز {"\u0698", "\ufb8a", "\u0698", "\ufb8b", "\ufb8b"}, // faa_JEH, // ژ {"\u0633", "\ufeb1", "\ufeb3", "\ufeb4", "\ufeb2"}, // faa_SEEN, // س {"\u0634", "\ufeb5", "\ufeb7", "\ufeb8", "\ufeb6"}, // faa_SHEEN, // ش {"\u0635", "\ufeb9", "\ufebb", "\ufebc", "\ufeba"}, // faa_SAAD, // ص {"\u0636", "\ufebd", "\ufebf", "\ufec0", "\ufebe"}, // faa_ZAAD, // ض {"\u0637", "\ufec1", "\ufec3", "\ufec4", "\ufec2"}, // faa_TAAH, // ط {"\u0638", "\ufec5", "\ufec7", "\ufec8", "\ufec6"}, // faa_ZAAH, // ظ {"\u0639", "\ufec9", "\ufecb", "\ufecc", "\ufeca"}, // faa_AIN, // ع {"\u063a", "\ufecd", "\ufecf", "\ufed0", "\ufece"}, // faa_GHAIN, // غ {"\u0641", "\ufed1", "\ufed3", "\ufed4", "\ufed2"}, // faa_FEH, // ف {"\u0642", "\ufed5", "\ufed7", "\ufed8", "\ufed6"}, // faa_QAAF, // ق {"\u06a9", "\ufed9", "\ufedb", "\ufedc", "\ufeda"}, // faa_KAAF, // ک // I had to change all forms to due to rendering issues in DX faa_KAAF_NO_HEAD | original: u8"\ufb8e", u8"\ufb90", u8"\ufb91", u8"\ufb8f" {"\u0643", "\ufed9", "\ufedb", "\ufedc", "\ufeda"}, // faa_KAAF_NO_HEAD, // ك {"\u06af", "\ufb92", "\ufb94", "\ufb95", "\ufb93"}, // faa_GAAF, // گ {"\u0644", "\ufedd", "\ufedf", "\ufee0", "\ufede"}, // faa_LAAM, // ل {"\u0645", "\ufee1", "\ufee3", "\ufee4", "\ufee2"}, // faa_MEEM, // م {"\u0646", "\ufee5", "\ufee7", "\ufee8", "\ufee6"}, // faa_NOON, // ن {"\u0647", "\ufee9", "\ufeeb", "\ufeec", "\ufeea"}, // faa_HEH, // ه {"\u0648", "\ufeed", "\ufeed", "\ufeee", "\ufeee"}, // faa_VAAV, // و {"\u06cc", "\ufbfc", "\ufbfe", "\ufbff", "\ufbfd"}, // faa_YEH, // ی {"\u064a", "\ufef1", "\ufef3", "\ufef4", "\ufef2"}, // faa_ARABIC_YEH, // ي {"\u0649", "\ufeef", "\u0649", "\ufef0", "\ufef0"}, // faa_ALEF_MAKSURA, // ى {"\u0640", "\u0640", "\u0640", "\u0640", "\u0640"}, // faa_TATWEEL, // ـ {"\ufefb", "\ufefb", "\ufefb", "\ufefc", "\ufefc"}, // faa_LAAM_ALEF, // لا {"\ufef7", "\ufef7", "\ufef7", "\ufef8", "\ufef8"}, // faa_LAAM_ALEF_HAMZA_ABOVE, // لأ };

CTRRL commented 6 months ago

this works, thanks. However how would I use it? can you give me a sample. i failed trying to get this to work. code: `static const ImWchar ranges[] = { 0x0020, 0x00FF, // Basic Latin 0x2010, 0x205E, // Punctuations 0x0600, 0x06FF, // Farsi/Arabic 0xFE00, 0xFEFF, // Farsi/Arabic 0, }; io.Fonts->AddFontFromFileTTF("C:\Windows\Fonts\Arial.ttf", 17, 0, ranges);

std::string ArabicText = FarsiType::ConvertToFAGlyphs("السلام عليكم"); ImGui::Text(ArabicText.c_str());`

it just displays a bunch of question marks "?"

AmyrAhmady commented 5 months ago

I'm closing this, way too many changes you have added for your own personal reasons, you even added a license with your own name for a library/work that is not yours, please remove that or link to original repository (this one) in your license

oscar7070 commented 5 months ago

I am sorry, i made some changes: https://github.com/oscar7070/RTLType. I have deleted all versions with my license. And i thing i don't actually know how the pull request works, i didn't know that every new change is go's to this pull request i am sorry for this cringe.

Does now it's fine? https://github.com/oscar7070/RTLType/blob/master/LICENSE i am really sorry for this.