mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Fonts: calling ImFontAtlas::Clear() mid-frame without re-adding a font will lead to a more explicit crash. (#9067)
+ reformat Changelog.
This commit is contained in:
parent
d246850787
commit
ec6219752d
4 changed files with 21 additions and 13 deletions
|
|
@ -79,17 +79,21 @@ Other Changes:
|
|||
to auto-size on a given axis would keep marking ini settings as dirty.
|
||||
- Disabled: fixed a bug when a previously enabled item that got nav focus
|
||||
and then turns disabled could still be activated using keyboard. (#9036)
|
||||
- InputText: when buffer is not resizable, trying to paste contents that
|
||||
cannot fit will now truncate text to nearest UTF-8 codepoint boundaries,
|
||||
instead of completely ignoring the paste. (#9029)
|
||||
- InputText: avoid continuously overwriting ownership of ImGuiKey_Enter/_KeypadEnter
|
||||
keys in order to allow e.g. external Shortcut override behavior. (#9004)
|
||||
- InputText: when using a callback to reduce/manipulate the value of BufTextLen,
|
||||
we do not require anymore that CursorPos be clamped by user code. (#9029)
|
||||
- InputTextMultiline: fixed a crash when using ImGuiInputTextFlags_WordWrap and
|
||||
resizing the parent window while keeping the multi-line field active (which is
|
||||
most typically achieved when resizing programmatically or via a docking layout
|
||||
reacting to a platform window resize). (#3237, #9007) [@anton-kl, @ocornut]
|
||||
- InputText:
|
||||
- When buffer is not resizable, trying to paste contents that cannot
|
||||
fit will now truncate text to nearest UTF-8 codepoint boundaries,
|
||||
instead of completely ignoring the paste. (#9029)
|
||||
- Avoid continuously overwriting ownership of ImGuiKey_Enter/_KeypadEnter
|
||||
keys in order to allow e.g. external Shortcut override behavior. (#9004)
|
||||
- When using a callback to reduce/manipulate the value of BufTextLen,
|
||||
we do not require anymore that CursorPos be clamped by user code. (#9029)
|
||||
- InputTextMultiline: fixed a crash when using ImGuiInputTextFlags_WordWrap and
|
||||
resizing the parent window while keeping the multi-line field active (which is
|
||||
most typically achieved when resizing programmatically or via a docking layout
|
||||
reacting to a platform window resize). (#3237, #9007) [@anton-kl, @ocornut]
|
||||
- Fonts:
|
||||
- Calling ImFontAtlas::Clear() mid-frame without re-adding a font will
|
||||
lead to a more explicit crash.
|
||||
- Textures:
|
||||
- Fixed an issue preventing multi-contexts from using each others' fonts
|
||||
if context 2 runs after context 1's Render() function. (#9039)
|
||||
|
|
|
|||
2
imgui.h
2
imgui.h
|
|
@ -3638,7 +3638,7 @@ struct ImFontAtlas
|
|||
IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels = 0.0f, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
|
||||
IMGUI_API void RemoveFont(ImFont* font);
|
||||
|
||||
IMGUI_API void Clear(); // Clear everything (input fonts, output glyphs/textures)
|
||||
IMGUI_API void Clear(); // Clear everything (input fonts, output glyphs/textures).
|
||||
IMGUI_API void CompactCache(); // Compact cached glyphs and texture.
|
||||
IMGUI_API void SetFontLoader(const ImFontLoader* font_loader); // Change font loader at runtime.
|
||||
|
||||
|
|
|
|||
|
|
@ -2656,6 +2656,7 @@ ImFontAtlas::~ImFontAtlas()
|
|||
TexData = NULL;
|
||||
}
|
||||
|
||||
// If you call this mid-frame, you would need to add new font and bind them!
|
||||
void ImFontAtlas::Clear()
|
||||
{
|
||||
bool backup_renderer_has_textures = RendererHasTextures;
|
||||
|
|
@ -2706,6 +2707,8 @@ void ImFontAtlas::ClearFonts()
|
|||
{
|
||||
// FIXME-NEWATLAS: Illegal to remove currently bound font.
|
||||
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!");
|
||||
for (ImFont* font : Fonts)
|
||||
ImFontAtlasBuildNotifySetFont(this, font, NULL);
|
||||
ImFontAtlasBuildDestroy(this);
|
||||
ClearInputData();
|
||||
Fonts.clear_delete();
|
||||
|
|
@ -3200,7 +3203,7 @@ ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed
|
|||
|
||||
// On font removal we need to remove references (otherwise we could queue removal?)
|
||||
// We allow old_font == new_font which forces updating all values (e.g. sizes)
|
||||
static void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont* new_font)
|
||||
void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont* new_font)
|
||||
{
|
||||
for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3856,6 +3856,7 @@ IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas);
|
|||
IMGUI_API void ImFontAtlasBuildDestroy(ImFontAtlas* atlas);
|
||||
IMGUI_API void ImFontAtlasBuildMain(ImFontAtlas* atlas);
|
||||
IMGUI_API void ImFontAtlasBuildSetupFontLoader(ImFontAtlas* atlas, const ImFontLoader* font_loader);
|
||||
IMGUI_API void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont* new_font);
|
||||
IMGUI_API void ImFontAtlasBuildUpdatePointers(ImFontAtlas* atlas);
|
||||
IMGUI_API void ImFontAtlasBuildRenderBitmapFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char);
|
||||
IMGUI_API void ImFontAtlasBuildClear(ImFontAtlas* atlas); // Clear output and custom rects
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue