MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / AddFontFromMemoryCompressedTTF

Method AddFontFromMemoryCompressedTTF

imgui_tiny_app/imgui/imgui_draw.cpp:3235–3245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3233}
3234
3235ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
3236{
3237 const unsigned int buf_decompressed_size = stb_decompress_length((const unsigned char*)compressed_ttf_data);
3238 unsigned char* buf_decompressed_data = (unsigned char*)IM_ALLOC(buf_decompressed_size);
3239 stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size);
3240
3241 ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
3242 IM_ASSERT(font_cfg.FontData == NULL);
3243 font_cfg.FontDataOwnedByAtlas = true;
3244 return AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, size_pixels, &font_cfg, glyph_ranges);
3245}
3246
3247ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
3248{

Callers

nothing calls this directly

Calls 3

stb_decompress_lengthFunction · 0.85
stb_decompressFunction · 0.85
ImFontConfigClass · 0.85

Tested by

no test coverage detected