ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

FontAwesome6 show up as unknown #402

Closed krulci closed 1 year ago

krulci commented 1 year ago

I added FontAwesome6 to ImGui.NET.SampleProgram from here: [https://github.com/juliettef/IconFontCppHeaders/blob/main/IconsFontAwesome6.cs](https://github.com/zaafar/ClickableTransparentOverlay/issues/url)

private static unsafe void SubmitUI()
        {
            // Demo code adapted from the official Dear ImGui demo program:
            // https://github.com/ocornut/imgui/blob/master/examples/example_win32_directx11/main.cpp#L172

            // 1. Show a simple window.
            // Tip: if we don't call ImGui.BeginWindow()/ImGui.EndWindow() the widgets automatically appears in a window called "Debug".
            {
                ImFontConfig fontConfig = default;
                ImFontConfigPtr fontConfigPtr = new ImFontConfigPtr(&fontConfig);
                fontConfigPtr.MergeMode = false;
                //ImGui.GetIO().Fonts.AddFontDefault(fontConfigPtr);
                int[] icons = { 0xe005, 0xf8ff, 0 };
                fixed (void* iconsPtr = icons)
                {
                    Console.WriteLine(FontAwesome6.FontIconFileNameFAS);
                    ImGui.GetIO().Fonts.AddFontFromFileTTF(FontAwesome6.FontIconFileNameFAS, 16.0f);
                }
                ImGui.Text("Hello, world!");                                        // Display some text (you can use a format string too)

The result show up as unknown: image

zaafar commented 1 year ago

based on this, I am gonna assume this is resolved. https://github.com/zaafar/ClickableTransparentOverlay/issues/44

tomvdb commented 11 months ago

Any chance those changes can be implemented on one of the ImGui.Net samples? I'm struggling to get this working and would like to use FontAwesome6 icons in my project. Currently just getting ? on the utf codes.

Thanks, T

zaafar commented 11 months ago

I can not bring that feature in isolation to imgui.net samples. That feature rely on imagesharp and that repo isn't using veldrid (unlike imgui.net samples).

I can bring the whole project in imgui.net as a sample but then what's the point? Can't you just look at that repo sample rather than looking at imgui.net sample?

tomvdb commented 11 months ago

No worries, Ill figure something out. Thanks