示例#1
0
        public ImFontPtr AddFontDefault(ImFontConfig font_cfg)
        {
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;
            ImFont *            ret             = ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, native_font_cfg);

            return(new ImFontPtr(ret));
        }
示例#2
0
        public ImFontPtr AddFontDefault()
        {
            ImFontConfigNative *font_cfg = null;
            ImFont *            ret      = ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, font_cfg);

            return(new ImFontPtr(ret));
        }
示例#3
0
 public void Dispose()
 {
     if (NativePtr != null)
     {
         ImGuiNative.ImFontConfig_destroy(NativePtr);
         NativePtr = null;
     }
 }
示例#4
0
        public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfig font_cfg)
        {
            void *native_font_data = font_data.ToPointer();
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;
            ushort *            glyph_ranges    = null;
            ImFont *            ret             = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, glyph_ranges);

            return(new ImFontPtr(ret));
        }
示例#5
0
        public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels)
        {
            void *native_compressed_font_data = compressed_font_data.ToPointer();
            ImFontConfigNative *font_cfg      = null;
            ushort *            glyph_ranges  = null;
            ImFont *            ret           = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, font_cfg, glyph_ranges);

            return(new ImFontPtr(ret));
        }
示例#6
0
        public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfig font_cfg, ref ushort glyph_ranges)
        {
            void *native_compressed_font_data   = compressed_font_data.ToPointer();
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;

            fixed(ushort *native_glyph_ranges = &glyph_ranges)
            {
                ImFont *ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, native_glyph_ranges);

                return(new ImFontPtr(ret));
            }
        }
示例#7
0
        public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels)
        {
            int   compressed_font_data_base85_byteCount = (compressed_font_data_base85 != null) ? Encoding.UTF8.GetByteCount(compressed_font_data_base85) : 0;
            byte *native_compressed_font_data_base85    = stackalloc byte[compressed_font_data_base85_byteCount + 1];

            fixed(char *compressed_font_data_base85_ptr = compressed_font_data_base85)
            {
                int native_compressed_font_data_base85_offset = (compressed_font_data_base85 != null) ? Encoding.UTF8.GetBytes(compressed_font_data_base85_ptr, compressed_font_data_base85.Length, native_compressed_font_data_base85, compressed_font_data_base85_byteCount) : 0;

                native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
            }

            native_compressed_font_data_base85 = (compressed_font_data_base85 != null) ? native_compressed_font_data_base85 : null;
            ImFontConfigNative *font_cfg     = null;
            ushort *            glyph_ranges = null;
            ImFont *            ret          = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, font_cfg, glyph_ranges);

            return(new ImFontPtr(ret));
        }
示例#8
0
        public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfig font_cfg)
        {
            int   filename_byteCount = (filename != null) ? Encoding.UTF8.GetByteCount(filename) : 0;
            byte *native_filename    = stackalloc byte[filename_byteCount + 1];

            fixed(char *filename_ptr = filename)
            {
                int native_filename_offset = (filename != null) ? Encoding.UTF8.GetBytes(filename_ptr, filename.Length, native_filename, filename_byteCount) : 0;

                native_filename[native_filename_offset] = 0;
            }

            native_filename = (filename != null) ? native_filename : null;
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;
            ushort *            glyph_ranges    = null;
            ImFont *            ret             = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, glyph_ranges);

            return(new ImFontPtr(ret));
        }
示例#9
0
 public ImFontConfig(IntPtr nativePtr)
 {
     NativePtr = (ImFontConfigNative *)nativePtr;
 }
示例#10
0
 public ImFontConfig(ImFontConfigNative *nativePtr)
 {
     NativePtr = nativePtr;
 }
示例#11
0
 public ImFontConfig()
 {
     NativePtr = ImGuiNative.ImFontConfig_ImFontConfig();
 }