mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: fixed implicit init when calling AddCustomRectRegular(). LoaderShutdown match BuildDestroy.
This commit is contained in:
parent
7ac1bff482
commit
e76cfe5aad
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue