// 'compressed_ttf_data' still owned by caller. Compress with binary_to_compressed_c.cpp unsafe ImFont AddFontFromMemoryCompressedTTF(byte *compressed_ttf_data, uint compressed_ttf_size, float size_pixels, ImFontConfig font_cfg_template = null, char[] glyph_ranges = null) { uint buf_decompressed_size = STB.stb_decompress_length(compressed_ttf_data); //unsigned char* buf_decompressed_data = (unsigned char*)ImGui::MemAlloc(buf_decompressed_size); byte[] _buf_decompressed_data = new byte[buf_decompressed_size]; fixed(byte *buf_decompressed_data = _buf_decompressed_data) { STB.stb_decompress(buf_decompressed_data, compressed_ttf_data, compressed_ttf_size); ImFontConfig font_cfg = font_cfg_template ?? new ImFontConfig(); System.Diagnostics.Debug.Assert(font_cfg.FontData == null); font_cfg.FontDataOwnedByAtlas = true; return(AddFontFromMemoryTTF(_buf_decompressed_data, (int)buf_decompressed_size, size_pixels, font_cfg_template, glyph_ranges)); } }