ImFontAtlas_AddFontFromFileTTF() private method

private ImFontAtlas_AddFontFromFileTTF ( NativeFontAtlas atlas, string filename, float size_pixels, IntPtr font_cfg, char glyph_ranges ) : NativeFont*
atlas NativeFontAtlas
filename string
size_pixels float
font_cfg System.IntPtr
glyph_ranges char
return NativeFont*
Ejemplo n.º 1
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.º 2
0
        public Font AddFontFromFileTTF(string fileName, float pixelSize)
        {
            NativeFont *nativeFontPtr = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(_atlasPtr, fileName, pixelSize, IntPtr.Zero, null);

            return(new Font(nativeFontPtr));
        }