public static unsafe Font AddFontFromFileTTF(this FontAtlas atlas, string fileName, float pixelSize, FontConfig config, char[] glyphRanges)
        {
            NativeFontAtlas *atlasPtr = ImGui.GetIO().GetNativePointer()->FontAtlas;
            IntPtr           cfgPtr   = Marshal.AllocHGlobal(Marshal.SizeOf(config));

            Marshal.StructureToPtr(config, cfgPtr, false);
            fixed(char *glyphPtr = &glyphRanges[0])
            {
                NativeFont *fontPtr =
                    ImGuiNative.ImFontAtlas_AddFontFromFileTTF(atlasPtr, fileName, pixelSize, cfgPtr, glyphPtr);

                return(new Font(fontPtr));
            }
        }
        public static void AddFontFromFileTTF(string filename, float sizePixels, FontConfig config, char[] glyphRanges)
        {
            IO io = ImGui.GetIO();

            config.OversampleH        = 1;
            config.OversampleV        = 1;
            config.RasterizerMultiply = 1;
            IntPtr cnfPtr = Marshal.AllocHGlobal(Marshal.SizeOf <FontConfig>());

            Marshal.StructureToPtr(config, cnfPtr, false);

            unsafe
            {
                NativeFontAtlas *atlas = io.GetNativePointer()->FontAtlas;
                fixed(char *glyphs = &glyphRanges[0])
                {
                    ImGuiNative.ImFontAtlas_AddFontFromFileTTF(atlas, filename, sizePixels, cnfPtr,
                                                               glyphs);
                }
            }
        }
示例#3
0
 public FontAtlas(NativeFontAtlas *atlasPtr)
 {
     _atlasPtr = atlasPtr;
 }
示例#4
0
文件: IO.cs 项目: mellinoe/ImGui.NET
 public FontAtlas(NativeFontAtlas* atlasPtr)
 {
     _atlasPtr = atlasPtr;
 }
示例#5
0
 public static extern NativeFont *ImFontAtlas_AddFontFromMemoryCompressedTTF(NativeFontAtlas *atlas, void *compressed_ttf_data, int compressed_ttf_size, float size_pixels, FontConfig *font_cfg, char *glyph_ranges);
示例#6
0
 public static extern NativeFont *ImFontAtlas_AddFontFromMemoryTTF(NativeFontAtlas *atlas, void *ttf_data, int ttf_size, float size_pixels, IntPtr font_cfg, char *glyph_ranges);
示例#7
0
 public static extern NativeFont *ImFontAtlas_AddFontFromFileTTF(NativeFontAtlas *atlas, string filename, float size_pixels, IntPtr font_cfg, char *glyph_ranges);
示例#8
0
 public static NativeFont *ImFontAtlas_AddFontDefault(NativeFontAtlas *atlas)
 {
     return(ImFontAtlas_AddFontDefault(atlas, IntPtr.Zero));
 }
示例#9
0
 public static extern NativeFont *ImFontAtlas_AddFontDefault(NativeFontAtlas *atlas, IntPtr font_cfg);
示例#10
0
 public static extern NativeFont *ImFontAtlas_AddFont(NativeFontAtlas *atlas, ref FontConfig font_cfg);
示例#11
0
 public static extern void ImFontAtlas_SetTexID(NativeFontAtlas *atlas, void *tex);
示例#12
0
 public static extern void ImFontAtlas_GetTexDataAsAlpha8(NativeFontAtlas *atlas, byte **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel);
示例#13
0
 public static extern void ImFontAtlas_Clear(NativeFontAtlas *atlas);
示例#14
0
 public static extern NativeFont *ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativeFontAtlas *atlas, string compressed_ttf_data_base85, float size_pixels, FontConfig *font_cfg, char *glyph_ranges);