Ejemplo n.º 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));
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfig font_cfg, ref ushort glyph_ranges)
        {
            void *native_font_data = font_data.ToPointer();
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;

            fixed(ushort *native_glyph_ranges = &glyph_ranges)
            {
                ImFont *ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, native_glyph_ranges);

                return(new ImFontPtr(ret));
            }
        }
Ejemplo n.º 4
0
        public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfig font_cfg)
        {
            void *native_compressed_font_data   = compressed_font_data.ToPointer();
            ImFontConfigNative *native_font_cfg = font_cfg.NativePtr;
            ushort *            glyph_ranges    = null;
            ImFont *            ret             = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, glyph_ranges);

            return(new ImFontPtr(ret));
        }
Ejemplo n.º 5
0
        public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfig font_cfg, ref ushort glyph_ranges)
        {
            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 *native_font_cfg = font_cfg.NativePtr;

            fixed(ushort *native_glyph_ranges = &glyph_ranges)
            {
                ImFont *ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges);

                return(new ImFontPtr(ret));
            }
        }
 public ImFontConfigPtr(ref ImFontConfig fontConfig)
 {
     NativePtr = (ImFontConfig *)Unsafe.AsPointer(ref fontConfig);
 }