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); } } }
public FontAtlas(NativeFontAtlas *atlasPtr) { _atlasPtr = atlasPtr; }
public FontAtlas(NativeFontAtlas* atlasPtr) { _atlasPtr = atlasPtr; }
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);
public static extern NativeFont *ImFontAtlas_AddFontFromMemoryTTF(NativeFontAtlas *atlas, void *ttf_data, int ttf_size, float size_pixels, IntPtr font_cfg, char *glyph_ranges);
public static extern NativeFont *ImFontAtlas_AddFontFromFileTTF(NativeFontAtlas *atlas, string filename, float size_pixels, IntPtr font_cfg, char *glyph_ranges);
public static NativeFont *ImFontAtlas_AddFontDefault(NativeFontAtlas *atlas) { return(ImFontAtlas_AddFontDefault(atlas, IntPtr.Zero)); }
public static extern NativeFont *ImFontAtlas_AddFontDefault(NativeFontAtlas *atlas, IntPtr font_cfg);
public static extern NativeFont *ImFontAtlas_AddFont(NativeFontAtlas *atlas, ref FontConfig font_cfg);
public static extern void ImFontAtlas_SetTexID(NativeFontAtlas *atlas, void *tex);
public static extern void ImFontAtlas_GetTexDataAsAlpha8(NativeFontAtlas *atlas, byte **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel);
public static extern void ImFontAtlas_Clear(NativeFontAtlas *atlas);
public static extern NativeFont *ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativeFontAtlas *atlas, string compressed_ttf_data_base85, float size_pixels, FontConfig *font_cfg, char *glyph_ranges);