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

cannot convert from initializer list to vector #8

Open CTRRL opened 6 months ago

CTRRL commented 6 months ago

so I just implemented the farsitype files into my project and the const std::vector<std::vector> fa_AlphabetsAllForms list has an error Severity Code Description Project File Line Suppression State Details Error C2440 'initializing': cannot convert from 'initializer list' to 'std::vector<std::vector<std::wstring,std::allocator>,std::allocator<std::vector<std::wstring,std::allocator>>>' ImGui Loader base farsitype.cpp 4

I do gt some other errors when the charset is set to unicode.

Help, thanks!

oscar7070 commented 6 months ago

It's because you use the newer version of c++ you need to change the fa_AlphabetsAllForms collection in FarsiType.cpp to this:

And make sure that you are using utf-8 in your project.

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

It's because you use the newer version of c++ you need to change the fa_AlphabetsAllForms collection in FarsiType.cpp to this:

And make sure that you are using utf-8 in your project.

const 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, // لأ };

Thanks! This worked however, I do have another problem. thats my 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 "?"

oscar7070 commented 6 months ago

You need all of this for Arabic/Farsi and Hebrew if it's still show you questions try to use other font.

const ImWchar ranges[] = { 0x0020, 0x00FF, // Latin 0x0600, 0x06FF, // Arabic 0x0750, 0x077F, // Arabic Supplement 0x08A0, 0x08FF, // Arabic extended 0xFB50, 0xFDFF, // Arabic Presentation Forms-A 0xFE70, 0xFEFF, // Arabic Presentation Forms-B 0x0590, 0x05FF, // Hebrew 0 };

I am using this font "GoNotoKurrent-Regular.ttf" it's working with Arabic: https://github.com/satbyy/go-noto-universal/releases/tag/v7.0

CTRRL commented 6 months ago

You need all of this for Arabic/Farsi and Hebrew if it's still show you questions try to use other font.

const ImWchar ranges[] = { 0x0020, 0x00FF, // Latin 0x0600, 0x06FF, // Arabic 0x0750, 0x077F, // Arabic Supplement 0x08A0, 0x08FF, // Arabic extended 0xFB50, 0xFDFF, // Arabic Presentation Forms-A 0xFE70, 0xFEFF, // Arabic Presentation Forms-B 0x0590, 0x05FF, // Hebrew 0 };

I am using this font "GoNotoKurrent-Regular.ttf" it's working with Arabic: https://github.com/satbyy/go-noto-universal/releases/tag/v7.0

const ImWchar ranges[] = { 0x0020, 0x00FF, // Latin 0x0600, 0x06FF, // Arabic 0x0750, 0x077F, // Arabic Supplement 0x08A0, 0x08FF, // Arabic extended 0xFB50, 0xFDFF, // Arabic Presentation Forms-A 0xFE70, 0xFEFF, // Arabic Presentation Forms-B 0x0590, 0x05FF, // Hebrew 0 };

io.Fonts->AddFontFromFileTTF("C:\Users\ctrl\Downloads\GoNotoKurrent-Regular.ttf", 17.f, 0, ranges);

it crashed with a "Access violation" on the "AddGlyph" function.

oscar7070 commented 6 months ago

The problem is in the file name the font name is "GoNotoCurrent-Regular.ttf" and your GoNotoKurrent-Regular.ttf" you are using K on Current and not C.

CTRRL commented 6 months ago

The problem is in the file name the font name is "GoNotoCurrent-Regular.ttf" and your GoNotoKurrent-Regular.ttf" you are using K on Current and not C.

the file itself named "GoNotoKurrent-Regular.ttf". I was wondering if you could send me a working sample/example.

oscar7070 commented 6 months ago
        // Setup Dear ImGui context
        IMGUI_CHECKVERSION();
        ImGui::CreateContext();
        ImGuiIO& io = ImGui::GetIO(); (void)io;
        io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
        io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
        io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
        io.ConfigFlags |= ImGuiConfigFlags_NavEnableSetMousePos;
        io.ConfigFlags |= ImGuiConfigFlags_IsSRGB;
        io.IniFilename = nullptr;
        io.LogFilename = nullptr;

        std::string fontPath = std::string(ExtremeEngineCPP::DirectoryHelper::GetMainDir()) + "\\Engine\\Fonts\\CascadiaCode\\GoNotoCurrent-Regular.ttf";

        const ImWchar ranges[] =
        {
            0x0020, 0x00FF, // Latin
            0x0600, 0x06FF, // Arabic
            0x0750, 0x077F, // Arabic Supplement
            0x08A0, 0x08FF, // Arabic extended
            0xFB50, 0xFDFF, // Arabic Presentation Forms-A
            0xFE70, 0xFEFF, // Arabic Presentation Forms-B
            0x0590, 0x05FF, // Hebrew
            0x00A0, 0x00FF, // Latin - 1 Supplement
            0x0100, 0x017F, // Latin Extended - A
            0x0180, 0x024F, // Latin Extended - B
            0x0250, 0x02AF, // IPA Extensions
            0x02B0, 0x02FF, // Spacing Modifier Letters 
            0x0300, 0x036F, // Combining Diacritical Marks
            0x0370, 0x03FF, // Greek and Coptic  
            0x0400, 0x04FF, // Cyrillic 
            0x0500, 0x052F, // Cyrillic Supplementary
            0x0530, 0x058F, // Armenian  
            0x0700, 0x074F, // Syriac    
            0x0780, 0x07BF, // Thaana    
            0x0900, 0x097F, // Devanagari
            0x0980, 0x09FF, // Bengali   
            0x0A00, 0x0A7F, // Gurmukhi  
            0x0A80, 0x0AFF, // Gujarati  
            0x0B00, 0x0B7F, // Oriya        
            0x0B80, 0x0BFF, // Tamil     
            0x0C00, 0x0C7F, // Telugu    
            0x0C80, 0x0CFF, // Kannada      
            0x0D00, 0x0D7F, // Malayalam     
            0x0D80, 0x0DFF, // Sinhala      
            0x0E00, 0x0E7F, // Thai  
            0x0E80, 0x0EFF, // Lao      
            0x0F00, 0x0FFF, // Tibetan   
            0x1000, 0x109F, // Myanmar  
            0x10A0, 0x10FF, // Georgian
            0x1100, 0x11FF, // Hangul Jamo  
            0x1200, 0x137F, // Ethiopic  
            0x13A0, 0x13FF, // Cherokee 
            0x1400, 0x167F, // Unified Canadian Aboriginaivate Use Area
            0x1680, 0x169F, // Ogham     
            0x16A0, 0x16FF, // Runic        
            0x1700, 0x171F, // Tagalog  
            0x1720, 0x173F, // Hanunoo   
            0x1740, 0x175F, // Buhid    
            0x1760, 0x177F, // Tagbanwa  
            0x1780, 0x17FF, // Khmer    
            0x1800, 0x18AF, // Mongolian
            0x1900, 0x194F, // Limbu    
            0x1950, 0x197F, // Tai Le
            0x19E0, 0x19FF, // Khmer Symbols    
            0x1D00, 0x1D7F, // Phonetic Extensions
            0x1E00, 0x1EFF, // Latin Extended Additional    
            0x1F00, 0x1FFF, // Greek Extended   
            0x2000, 0x206F, // General Punctuation
            0x2070, 0x209F, // Superscripts and Subscripts
            0x20A0, 0x20CF, // Currency Symbols
            0x20D0, 0x20FF, // Combining Diacritical Marks for Symbols
            0x2100, 0x214F, // Letterlike Symbols
            0x2150, 0x218F, // Number Forms
            0x2190, 0x21FF, // Arrows
            0x2200, 0x22FF, // Mathematical Operators
            0x2300, 0x23FF, // Miscellaneous Technical
            0x2400, 0x243F, // Control Pictures
            0x2440, 0x245F, // Optical Character Recognition
            0x2460, 0x24FF, // Enclosed Alphanumerics
            0x2500, 0x257F, // Box Drawing
            //0x0020, 0xCFFF,
            0
        };

        ImFontConfig config;
        ImFont* mainFont = io.Fonts->AddFontFromFileTTF(fontPath.c_str(), 18, &config, ranges);
        io.FontDefault = mainFont;

//...

CTRRL commented 6 months ago
      // Setup Dear ImGui context
      IMGUI_CHECKVERSION();
      ImGui::CreateContext();
      ImGuiIO& io = ImGui::GetIO(); (void)io;
      io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
      io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
      io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
      io.ConfigFlags |= ImGuiConfigFlags_NavEnableSetMousePos;
      io.ConfigFlags |= ImGuiConfigFlags_IsSRGB;
      io.IniFilename = nullptr;
      io.LogFilename = nullptr;

      std::string fontPath = std::string(ExtremeEngineCPP::DirectoryHelper::GetMainDir()) + "\\Engine\\Fonts\\CascadiaCode\\GoNotoCurrent-Regular.ttf";

      const ImWchar ranges[] =
      {
          0x0020, 0x00FF, // Latin
          0x0600, 0x06FF, // Arabic
          0x0750, 0x077F, // Arabic Supplement
          0x08A0, 0x08FF, // Arabic extended
          0xFB50, 0xFDFF, // Arabic Presentation Forms-A
          0xFE70, 0xFEFF, // Arabic Presentation Forms-B
          0x0590, 0x05FF, // Hebrew
          0x00A0, 0x00FF, // Latin - 1 Supplement
          0x0100, 0x017F, // Latin Extended - A
          0x0180, 0x024F, // Latin Extended - B
          0x0250, 0x02AF, // IPA Extensions
          0x02B0, 0x02FF, // Spacing Modifier Letters 
          0x0300, 0x036F, // Combining Diacritical Marks
          0x0370, 0x03FF, // Greek and Coptic  
          0x0400, 0x04FF, // Cyrillic 
          0x0500, 0x052F, // Cyrillic Supplementary
          0x0530, 0x058F, // Armenian  
          0x0700, 0x074F, // Syriac    
          0x0780, 0x07BF, // Thaana    
          0x0900, 0x097F, // Devanagari
          0x0980, 0x09FF, // Bengali   
          0x0A00, 0x0A7F, // Gurmukhi  
          0x0A80, 0x0AFF, // Gujarati  
          0x0B00, 0x0B7F, // Oriya        
          0x0B80, 0x0BFF, // Tamil     
          0x0C00, 0x0C7F, // Telugu    
          0x0C80, 0x0CFF, // Kannada      
          0x0D00, 0x0D7F, // Malayalam     
          0x0D80, 0x0DFF, // Sinhala      
          0x0E00, 0x0E7F, // Thai  
          0x0E80, 0x0EFF, // Lao      
          0x0F00, 0x0FFF, // Tibetan   
          0x1000, 0x109F, // Myanmar  
          0x10A0, 0x10FF, // Georgian
          0x1100, 0x11FF, // Hangul Jamo  
          0x1200, 0x137F, // Ethiopic  
          0x13A0, 0x13FF, // Cherokee 
          0x1400, 0x167F, // Unified Canadian Aboriginaivate Use Area
          0x1680, 0x169F, // Ogham     
          0x16A0, 0x16FF, // Runic        
          0x1700, 0x171F, // Tagalog  
          0x1720, 0x173F, // Hanunoo   
          0x1740, 0x175F, // Buhid    
          0x1760, 0x177F, // Tagbanwa  
          0x1780, 0x17FF, // Khmer    
          0x1800, 0x18AF, // Mongolian
          0x1900, 0x194F, // Limbu    
          0x1950, 0x197F, // Tai Le
          0x19E0, 0x19FF, // Khmer Symbols    
          0x1D00, 0x1D7F, // Phonetic Extensions
          0x1E00, 0x1EFF, // Latin Extended Additional    
          0x1F00, 0x1FFF, // Greek Extended   
          0x2000, 0x206F, // General Punctuation
          0x2070, 0x209F, // Superscripts and Subscripts
          0x20A0, 0x20CF, // Currency Symbols
          0x20D0, 0x20FF, // Combining Diacritical Marks for Symbols
          0x2100, 0x214F, // Letterlike Symbols
          0x2150, 0x218F, // Number Forms
          0x2190, 0x21FF, // Arrows
          0x2200, 0x22FF, // Mathematical Operators
          0x2300, 0x23FF, // Miscellaneous Technical
          0x2400, 0x243F, // Control Pictures
          0x2440, 0x245F, // Optical Character Recognition
          0x2460, 0x24FF, // Enclosed Alphanumerics
          0x2500, 0x257F, // Box Drawing
          //0x0020, 0xCFFF,
          0
      };

      ImFontConfig config;
      ImFont* mainFont = io.Fonts->AddFontFromFileTTF(fontPath.c_str(), 18, &config, ranges);
      io.FontDefault = mainFont;

//...

for some weird reason, I've tried your code there no crash however the question marks is still there...

oscar7070 commented 6 months ago

Check your project properties. Screenshot_367 Screenshot_368

CTRRL commented 6 months ago

Check your project properties. Screenshot_367 Screenshot_368

I do got the char set to unicode, ive added the command, still question marks :( !

CTRRL commented 6 months ago

It's because you use the newer version of c++ you need to change the fa_AlphabetsAllForms collection in FarsiType.cpp to this:

And make sure that you are using utf-8 in your project.

const 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, // لأ };

add me on discord so we can have direct contact. my disocrd is: moat. (dot "." included).