public void SetDefaults() { unsafe { ImFontConfig *imFontConfig = ImGuiNative.ImFontConfig_ImFontConfig(); SetFrom(imFontConfig); ImGuiNative.ImFontConfig_destroy(imFontConfig); } }
public ImFontConfigPtr(ImFontConfig *nativePtr) => NativePtr = nativePtr;
public static void Init() { if (_Initialized) { return; } _Initialized = true; IntPtr context = ImGui.CreateContext(); ImGui.SetCurrentContext(context); ImGuiIOPtr io = ImGui.GetIO(); io.KeyMap[(int)ImGuiKey.Tab] = (int)SDL.SDL_Keycode.SDLK_TAB; io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)SDL.SDL_Scancode.SDL_SCANCODE_LEFT; io.KeyMap[(int)ImGuiKey.RightArrow] = (int)SDL.SDL_Scancode.SDL_SCANCODE_RIGHT; io.KeyMap[(int)ImGuiKey.UpArrow] = (int)SDL.SDL_Scancode.SDL_SCANCODE_UP; io.KeyMap[(int)ImGuiKey.DownArrow] = (int)SDL.SDL_Scancode.SDL_SCANCODE_DOWN; io.KeyMap[(int)ImGuiKey.PageUp] = (int)SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP; io.KeyMap[(int)ImGuiKey.PageDown] = (int)SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN; io.KeyMap[(int)ImGuiKey.Home] = (int)SDL.SDL_Scancode.SDL_SCANCODE_HOME; io.KeyMap[(int)ImGuiKey.End] = (int)SDL.SDL_Scancode.SDL_SCANCODE_END; io.KeyMap[(int)ImGuiKey.Delete] = (int)SDL.SDL_Keycode.SDLK_DELETE; io.KeyMap[(int)ImGuiKey.Backspace] = (int)SDL.SDL_Keycode.SDLK_BACKSPACE; io.KeyMap[(int)ImGuiKey.Enter] = (int)SDL.SDL_Keycode.SDLK_RETURN; io.KeyMap[(int)ImGuiKey.Escape] = (int)SDL.SDL_Keycode.SDLK_ESCAPE; io.KeyMap[(int)ImGuiKey.A] = (int)SDL.SDL_Keycode.SDLK_a; io.KeyMap[(int)ImGuiKey.C] = (int)SDL.SDL_Keycode.SDLK_c; io.KeyMap[(int)ImGuiKey.V] = (int)SDL.SDL_Keycode.SDLK_v; io.KeyMap[(int)ImGuiKey.X] = (int)SDL.SDL_Keycode.SDLK_x; io.KeyMap[(int)ImGuiKey.Y] = (int)SDL.SDL_Keycode.SDLK_y; io.KeyMap[(int)ImGuiKey.Z] = (int)SDL.SDL_Keycode.SDLK_z; //io.GetClipboardTextFn((userData) => SDL.SDL_GetClipboardText()); //io.SetSetClipboardTextFn((userData, text) => SDL.SDL_SetClipboardText(text)); unsafe { string rf = "Resources"; ImFontAtlasPtr fontAtlas = ImGui.GetIO().Fonts; var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder()); builder.AddText("Ωων"); //builder.AddRanges(fontAtlas.GetGlyphRangesDefault()); builder.BuildRanges(out ImVector ranges); fontAtlas.AddFontFromFileTTF(Path.Combine(rf, "ProggyClean.ttf"), 13); ImFontConfig * rawPtr = ImGuiNative.ImFontConfig_ImFontConfig(); ImFontConfigPtr config = new ImFontConfigPtr(rawPtr); config.MergeMode = true; fontAtlas.AddFontFromFileTTF(Path.Combine(rf, "DejaVuSans.ttf"), 13, config, ranges.Data); } if (io.Fonts.Fonts.Size == 0) { io.Fonts.AddFontDefault(); } }
public abstract ImFont *ImFontAtlas_AddFont(ImFontAtlas *self, ImFontConfig *font_cfg);
public abstract ImFont *ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(ImFontAtlas *self, byte *compressed_font_data_base85, float size_pixels, ImFontConfig *font_cfg, ushort *glyph_ranges);
public abstract void ImFontConfig_ImFontConfig(ImFontConfig *self);
public abstract ImFont *ImFontAtlas_AddFontFromFileTTF(ImFontAtlas *self, byte *filename, float size_pixels, ImFontConfig *font_cfg, ushort *glyph_ranges);
public abstract ImFont *ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas *self, void *font_data, int font_size, float size_pixels, ImFontConfig *font_cfg, ushort *glyph_ranges);