mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-01 01:34:57 +08:00
Fonts: fixed implicit init when calling AddCustomRectRegular(). LoaderShutdown match BuildDestroy.
This commit is contained in:
+4
-1
@@ -3231,6 +3231,9 @@ int ImFontAtlas::AddCustomRectRegular(int width, int height)
|
|||||||
IM_ASSERT(width > 0 && width <= 0xFFFF);
|
IM_ASSERT(width > 0 && width <= 0xFFFF);
|
||||||
IM_ASSERT(height > 0 && height <= 0xFFFF);
|
IM_ASSERT(height > 0 && height <= 0xFFFF);
|
||||||
|
|
||||||
|
if (Builder == NULL)
|
||||||
|
ImFontAtlasBuildInit(this);
|
||||||
|
|
||||||
ImFontAtlasRectId r_id = ImFontAtlasPackAddRect(this, width, height);
|
ImFontAtlasRectId r_id = ImFontAtlasPackAddRect(this, width, height);
|
||||||
if (r_id < 0)
|
if (r_id < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -4185,7 +4188,7 @@ void ImFontAtlasBuildDestroy(ImFontAtlas* atlas)
|
|||||||
if (loader && loader->FontSrcDestroy != NULL)
|
if (loader && loader->FontSrcDestroy != NULL)
|
||||||
loader->FontSrcDestroy(atlas, &font_cfg);
|
loader->FontSrcDestroy(atlas, &font_cfg);
|
||||||
}
|
}
|
||||||
if (atlas->FontLoader && atlas->FontLoader->LoaderShutdown)
|
if (atlas->Builder && atlas->FontLoader && atlas->FontLoader->LoaderShutdown)
|
||||||
{
|
{
|
||||||
atlas->FontLoader->LoaderShutdown(atlas);
|
atlas->FontLoader->LoaderShutdown(atlas);
|
||||||
IM_ASSERT(atlas->FontLoaderData == NULL);
|
IM_ASSERT(atlas->FontLoaderData == NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user