MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / ImFontAtlasBuildWithFreeType

Function ImFontAtlasBuildWithFreeType

KBotExt/imgui/imgui_freetype.cpp:753–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751}
752
753static bool ImFontAtlasBuildWithFreeType(ImFontAtlas* atlas)
754{
755 // FreeType memory management: https://www.freetype.org/freetype2/docs/design/design-4.html
756 FT_MemoryRec_ memory_rec = {};
757 memory_rec.user = NULL;
758 memory_rec.alloc = &FreeType_Alloc;
759 memory_rec.free = &FreeType_Free;
760 memory_rec.realloc = &FreeType_Realloc;
761
762 // https://www.freetype.org/freetype2/docs/reference/ft2-module_management.html#FT_New_Library
763 FT_Library ft_library;
764 FT_Error error = FT_New_Library(&memory_rec, &ft_library);
765 if (error != 0)
766 return false;
767
768 // If you don't call FT_Add_Default_Modules() the rest of code may work, but FreeType won't use our custom allocator.
769 FT_Add_Default_Modules(ft_library);
770
771 bool ret = ImFontAtlasBuildWithFreeTypeEx(ft_library, atlas, atlas->FontBuilderFlags);
772 FT_Done_Library(ft_library);
773
774 return ret;
775}
776
777const ImFontBuilderIO* ImGuiFreeType::GetBuilderForFreeType()
778{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected