Closed zhouxs1023 closed 8 years ago
Visual Studio 2013 doesn't support the new C++11 string literals, so you can either upgrade to a newer version of Visual Studio or use IconsFontAwesome_c.h which provides a more backwards compatible version.
I use IconsFontAwesome_c.h to build icon font,but crash in imgui_draw.cpp Line 1273 ==>"IM_ASSERT(font_offset >= 0);"
I'm not sure what's causing that. The code in the example on the readme and your code snippet (with the ImGui::Text called in the demo after the "Hello, world!" text).
I didn't notice before but the font ranges you're using are wrong - you should use:
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
as per the readme. However I don't think that is your problem. Can you post your code somewhere for me to take a look, and which version of ImGui are you using?
I used imgui1.50 wip+vs2013,compile it successfully,but run exe turn on crash in imgui_draw.cpp Line 1273 ==>"IM_ASSERT(font_offset >= 0);" Later I used imgui1.48+vs2013,but run exe turn on crash in imgui_draw.cpp Line 1248 ==>"IM_ASSERT(font_offset >= 0);"
I added codes steps as blow: steip 1.add header file; step2: add icon font code: step3:add text in imgui windows Additions: fontawesome-webfont.ttf IconsFontAwesome_c.h
I'm taking a look at this now - it would be easier with text and not images for the code but the changes are small so should be fairly easy to work out.
I've done exactly those changes with ImGui Version 1.50 WIP and VS2015 and don't get the crash.
If you could check if the program crashes without the changes, that would be great. Meanwhile I'll check out an install of Visual Studio 2013 which will take a fair amount of time to do.
May be .ttf file error,Redownload.ttf file,compile it sucessfully now,Thanks!
Great - I did manage to install VS2013 and this did indeed work, but glad you found the problem and solved it!
I use consFontAwesome.h in VS2013 +Imgui 1.50,but compile turn on C2065 error:u8 undeclared identifier as blow: step1: add #include "IconsFontAwesome.h" in main function; step2: ImGuiIO& io = ImGui::GetIO(); io.Fonts->AddFontDefault(); // merge in icons from Font Awesome static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; io.Fonts->AddFontFromFileTTF("../../extra_fonts/fontawesome-webfont.ttf", 16.0f, &icons_config, icons_ranges);
step3:ImGui::Text( ICON_FA_FILE " File" );
but compile turn on C2065 error:u8 undeclared identifier as blow: