Commit Graph
100 Commits
Author SHA1 Message Date
ocornut 9324961cd2 Fonts: fixed calling AddFontXXX not invalidating texture for legacy backends. 2025-06-11 15:55:28 +02:00
ocornut 44498825cd (Breaking) Fonts: PushFont() default to preserve current font size. 2025-06-11 15:54:53 +02:00
ocornut 168b97c291 Fonts: removed size rounding in AddFont() which breaks relative sizing of merged fonts (8502)
# Conflicts:
#	imgui.cpp
2025-06-11 15:54:52 +02:00
ocornut 2de15dc64b Fonts: fixed legacy backend path preloading all sources sizes erroneously + failing to use ellipsis. 2025-06-11 15:54:26 +02:00
ocornut 5460903f96 Fonts: awkwardly alias old TexID name to TexRef using an union (may backtrack and just keep old name) 2025-06-11 15:54:26 +02:00
ocornut cb4c03756a Fonts: detect if backend assign to texture on creation but doesn't update Status. 2025-06-11 15:54:26 +02:00
ocornut a548cd9934 Fonts: avoid both ImTextureRef fields being set simultaneously. 2025-06-11 15:54:12 +02:00
ocornut 0fff7ceda4 Fonts: comments, tweaks, minor amends.
Comments, tweaks
2025-06-11 15:53:42 +02:00
ocornut 8bd1fc4f04 Textures: Added ImTextureRef::GetTexID() mostly for consistency.
Without it the logic may seem more confusing to grok for end-user.
2025-06-11 15:53:42 +02:00
ocornut cc65015e4e Fonts: fixed crashing password fields.
# Conflicts:
#	imgui_internal.h
2025-06-11 15:53:41 +02:00
ocornut 41517bca0c (Breaking) Fonts: renamed CalcCustomRectUV() to GetCustomRectUV() for simplicity. 2025-06-11 15:52:21 +02:00
ocornut 4048494aa1 Fonts: rename ImFontAtlasBuildClearTexture() to ImFontAtlasBuildClear(). 2025-06-11 15:52:21 +02:00
ocornut f816b861fc (Breaking) Fonts: rename GetCustomRectByIndex() to GetCustomRect(). Made return struct const. 2025-06-11 15:52:12 +02:00
ocornut 85d0507580 Fonts: narrowed invalid value for ImFontAtlasRectId to -1 a we will change implementation. 2025-06-11 15:52:12 +02:00
ocornut b12c42e75d Fonts: change uses of ImFontAtlasRect to ImTextureRect for simplicity. 2025-06-11 15:52:12 +02:00
ocornut e76cfe5aad Fonts: fixed implicit init when calling AddCustomRectRegular(). LoaderShutdown match BuildDestroy. 2025-06-11 15:52:12 +02:00
ocornut 52a6863771 Textures: ImTextureData pixels are not immediately destroyed on setting ImTextureStatus_WantDestroy. 2025-06-11 15:52:12 +02:00
ocornut 735d31e54a Demo: Exposed some basic UI in demo for sanity. 2025-06-11 15:52:04 +02:00
ocornut 41a0e991f0 Fonts: Added UI to edit FreeType loader flags. Added ImFontAtlasBuildReloadAll() / ImFontAtlasBuildReloadFont() 2025-06-11 15:51:56 +02:00
ocornut 40f988ce2a Fonts: in ShowFontAtlas() preserve open-state for latest texture. Improve debug display. 2025-06-11 15:51:56 +02:00
ocornut c98e3c0eff Fonts: ImFontConfig::GlyphExcludeRanges is owner and copied. 2025-06-11 15:51:56 +02:00
ocornut da51485e17 Fonts: Obsolete GetGlyphRangesXXX() functions. Update font documentation. 2025-06-11 15:51:56 +02:00
ocornut 93410c47e1 Fonts: Fixed various small warnings / build issues. 2025-06-11 15:51:56 +02:00
ocornut dec8d3863a Fonts: Added a ImFontFlags_NoLoadError flag to let user code try file paths. (3611) 2025-06-11 15:51:56 +02:00
ocornut 131f5c57ab Textures: Detect when using a texture that's about to be destroyed. 2025-06-11 15:51:56 +02:00
ocornut 0b71339122 Demo: Add a "Fonts" section for visibility. 2025-06-11 15:51:33 +02:00
ocornut 161e222322 Fonts: GetFontBaked() default to searching for closest size font. 2025-06-11 15:51:30 +02:00
ocornut ef6beaeff6 Fonts: removed LockSingleSrcConfigIdx which isn't needed anymore since we don't load glyphs in ImFontAtlasBuildAddFont(). 2025-06-11 15:47:49 +02:00
ocornut d8a612f73b Fonts: Fallback glyph is now lazily loaded on demand (yay!). Moving ImFontBaked:: functions outside of class. 2025-06-11 15:47:49 +02:00
ocornut 78a17038c2 imgui_freetype: no need to store metrics locally. 2025-06-11 15:47:49 +02:00
ocornut 18c8a93cca Fonts: Rework ImFontLoader signatures.
InitBaked may return false to signify this size is not supported.
2025-06-11 15:47:49 +02:00
ocornut c06a7585a3 Fonts: A font source can specify its own loader/backend. 2025-06-11 15:47:41 +02:00
ocornut 1cfc0de31d Fonts: Core allocates per-baked-per-src backend buffers, to allow having custom backend per font source. Backend BakedInit/Destroy/AddGlyph process a single source. 2025-06-11 15:47:41 +02:00
ocornut d59f10d7f5 Fonts: reinstated ImFontAtlasBuildSetupFontCreateEllipsisFromDot() compatible with baked system, lazily baked. 2025-06-11 15:47:41 +02:00
ocornut 76b252f80a Fonts: Added ImFontAtlasBakedSetFontGlyphBitmap(). 2025-06-11 15:47:41 +02:00
ocornut 92993e68c8 Fonts: Baked system, fix subsequent sources overriding shared font metrics. 2025-06-11 15:47:41 +02:00
ocornut dc1320df64 Fonts: ImFontFlags: ImFontFlags_NoLoadGlyphs + add ImFontFlags_LockBakedSizes 2025-06-11 15:47:41 +02:00
ocornut 8a8d8a7b38 Fonts: Exposed CompactCache(). Hide ClearCache(). 2025-06-11 15:47:35 +02:00
ocornut eb79e3ab3d Fonts: Restore a functional AddCustomRectFontGlyph(). 2025-06-11 15:47:35 +02:00
ocornut 815553c4b4 Fonts: ImFontConfig: added GlyphExcludeRanges[]. 2025-06-11 15:47:35 +02:00
ocornut 96786a183b Fonts: Create a fallback glyph if none is available (fix crash on fonts with no fallback) 2025-06-11 15:47:34 +02:00
ocornut 82b81fce68 Fonts: PushFontSize() with -1 uses sources[0]'s size for now (backward compat design) 2025-06-11 15:47:34 +02:00
ocornut 6580590226 Fonts: Allow PushFont/NewFrame/PopFont idioms to function. 2025-06-11 15:47:29 +02:00
ocornut 842c313db2 Fonts: Reordered ImFont fields. 2025-06-11 15:47:25 +02:00
ocornut 99f6b305c1 Fonts: Baked system, v12: support GlyphOffset / GlyphMinAdvanceX / GlyphMaxAdvanceX by scaling from ref value.
Overwriting cfg->PixelSnapH = true; in imgui_freetype is weird.
2025-06-11 15:47:21 +02:00
ocornut df694c89b0 Fonts: Baked system, v11. 2025-06-11 15:47:17 +02:00
ocornut 57d345ff80 Textures: Comments around ImTextureID type. 2025-06-11 15:47:00 +02:00
ocornut 3ce753c489 Fonts: Debug dump to disk, debug log. 2025-06-11 15:47:00 +02:00
ocornut be151977ca Fonts: Texture resizing favor growing height, halve pack nodes. 2025-06-11 15:46:28 +02:00
ocornut daaf0e4ef3 Fonts: Added PushFontSize(), PopFontSize() api. Added font_size param to PushFont() as well.
Fonts: Fixed PopFont() recovery.

(To squash into "Added PushFontSize(), PopFontSize() api."
2025-06-11 15:46:28 +02:00
ocornut 80404fae30 Fonts: clarify ClearTexData() as not supported with dynamic atlases. 2025-06-11 15:46:28 +02:00
ocornut 093d01269a Fonts: Baked system, with auto-bind, v10.
# Conflicts:
#	imgui_internal.h
2025-06-11 15:46:27 +02:00
ocornut 7aba8da551 (Breaking) Fonts: CalcWordWrapPositionA() -> CalcWordWrapPosition(), takes size instead of scale as this will be needed. 2025-06-11 15:45:22 +02:00
ocornut a2371ef90b Internals: added ImStableVector<> helper. 2025-06-11 15:45:14 +02:00
ocornut fb69a09d6e Fonts: Fixed leak due to indirectly recursing ImFontAtlasPackInit(). 2025-06-11 15:45:14 +02:00
ocornut c5653d5f34 Fonts: stb_truetype loader: Reworked scale handling to suggest this is not required caching. 2025-06-11 15:45:14 +02:00
ocornut b203ac1e0d Fonts: Reduced reliance on ImFontConfig::DstFont. 2025-06-11 15:45:14 +02:00
ocornut 722f6013ff Fonts: Added a bit of user facing tooling. 2025-06-11 15:45:14 +02:00
ocornut bd19bc5085 Fonts: Removed BuildClearGlyphs(), conflated with ClearOutputData() 2025-06-11 15:45:14 +02:00
ocornut 2bf6552f2f Fonts: Fixed/improved support for legacy backend. SetTexID() writes into our ImTextureData to keep the indirection, clear TexIsBuilt.
The idea is that a legacy backend can somehow add a if (!atlas->IsBuilt()) ImGui_ImplXXXXX_CreateFontsTexture() call _after_ Render() and some features are supported.
2025-06-11 15:45:14 +02:00
ocornut ba62becb7d (Breaking) Fonts: remove ImFontAtlasCustomRect which is now the same as ImTextureRect 2025-06-11 15:45:08 +02:00
ocornut a509790a1c Fonts: Added back support for AddCustomRectFontGlyph()
Legacy path naturally works.
2025-06-11 15:45:08 +02:00
ocornut 953ce90d27 Fonts: ImFontAtlasBuildInit() uses the occasion to sync HasTexUpdates from imgui context, narrowing the scope where it isn't set. 2025-06-11 15:45:07 +02:00
ocornut 288055180e Fonts: Comments, remove ImFontAtlas facing BuildGrowTexture(), BuildCompactTexture(). Make IsBuilt() obsolete. 2025-06-11 15:45:07 +02:00
ocornut 8ed4e2dde7 Fonts: Basic heuristic to repack instead of growing. Moved rects count/surface to internals. 2025-06-11 15:45:07 +02:00
ocornut 2137b3448b Textures: Added atlas's TexMinWidth/TexMinHeight/TexMaxWidth/TexMaxHeight.
Fixed ImFontAtlasBuildGetTextureSizeEstimate().
Basic error handling on OOM.
2025-06-11 15:45:01 +02:00
ocornut 14614f561b Textures: Ensure UpdateBox is set on texture _WantCreate state too. 2025-06-11 15:45:01 +02:00
ocornut b06f3c6d1d Fonts: turn public facing BuildRegisterGlyph() into ImFontAtlasBuildAddFontGlyph() thats sets up UV. 2025-06-11 15:44:38 +02:00
ocornut 4ff1631b31 Fonts: Rasterizing ellipsis character from dot as one glyph + avoid preloading if it not needed.
# Conflicts:
#	imgui.cpp
2025-06-11 15:44:37 +02:00
ocornut cec3e945f0 Fonts: added ImFontAtlas::RemoveFont(), fixed various leaks. 2025-06-11 15:43:07 +02:00
ocornut df8450d928 Fonts: marked ImFontAtlas::Build() as obsolete 2025-06-11 15:43:07 +02:00
ocornut 4399599de9 Fonts: ClearCache(), ImFontAtlasBuildGetTextureSizeEstimate(), tweak clearing functions. 2025-06-11 15:43:06 +02:00
ocornut ef1521b472 Fonts: fix for password fields 2025-06-11 15:43:06 +02:00
ocornut a51a26e2aa Fonts: use a structure for post-processing - easier to pass things around and iterate on. 2025-06-11 15:43:06 +02:00
ocornut 553b1c301d Fonts: repack without full reload, discard rectangle, fixed CustomRect api with stable id, remove public BuildInit(). 2025-06-11 15:43:01 +02:00
ocornut a6c7801926 Fonts: Measured and tweaked CalcTextSize() computation to minimize cost in our stress tests. 2025-06-11 15:42:55 +02:00
ocornut 076a1ab85c Fonts: Misc amends, remove _PackNodesFactor, comments. 2025-06-11 15:42:54 +02:00
ocornut ac13683c26 Fonts: ImFontAtlas accept DrawListSharedData not being set. 2025-06-11 15:42:54 +02:00
ocornut 1269467fa0 imgui_freetype: Removing old code. 2025-06-11 15:41:16 +02:00
ocornut 08e1e7681e imgui_freetype: Added Freetype implementation for new architecture. 2025-06-11 15:41:16 +02:00
ocornut ee8941e0de Backends: Allegro5: added ImGuiBackendFlags_RendererHasTextures support. 2025-06-11 15:41:05 +02:00
ocornut 16fe666e36 Backends: SDLGPU3: added ImGuiBackendFlags_RendererHasTextures support.
# Conflicts:
#	backends/imgui_impl_sdlgpu3.cpp
#	backends/imgui_impl_sdlgpu3.h
2025-06-11 15:38:14 +02:00
ocornut e538883a20 Backends: SDL_Renderer3: added ImGuiBackendFlags_RendererHasTextures support. 2025-06-11 15:38:13 +02:00
ocornut 9fa65cd190 Backends: SDL_Renderer2: added ImGuiBackendFlags_RendererHasTextures support. 2025-06-11 15:37:50 +02:00
ocornut abe294bfd0 Backends: Vulkan: added ImGuiBackendFlags_RendererHasTextures support.
# Conflicts:
#	backends/imgui_impl_vulkan.cpp
2025-06-11 15:33:28 +02:00
ocornut 0430c55b84 Backends: OpenGL2: added ImGuiBackendFlags_RendererHasTextures support.
Removed ImGui_ImplOpenGL2_CreateFontsTexture() and ImGui_ImplOpenGL2_DestroyFontsTexture().
2025-06-11 15:30:45 +02:00
ocornut dbb91a574f Backends: OpenGL3: added ImGuiBackendFlags_RendererHasTextures support.
+ Removed ImGui_ImplOpenGL3_CreateFontsTexture() and ImGui_ImplOpenGL3_DestroyFontsTexture().
2025-06-11 15:29:14 +02:00
ocornut eefe5d5aac Backends: DirectX12: added ImGuiBackendFlags_RendererHasTextures support.
# Conflicts:
#	backends/imgui_impl_dx12.cpp
2025-06-11 15:27:19 +02:00
ocornut 2d2b1bc1cc Backends: DirectX10: added ImGuiBackendFlags_RendererHasTextures support.
# Conflicts:
#	backends/imgui_impl_dx10.cpp
#	backends/imgui_impl_dx10.h
2025-06-11 15:27:16 +02:00
ocornut 75efba7ec7 Backends: DirectX9: added ImGuiBackendFlags_RendererHasTextures support
# Conflicts:
#	backends/imgui_impl_dx9.cpp
2025-06-11 15:27:11 +02:00
ocornut 372fd27e71 Backends: DirectX11: added ImGuiBackendFlags_RendererHasTextures support.
# Conflicts:
#	backends/imgui_impl_dx11.cpp
2025-06-11 15:26:00 +02:00
ocornut c20e160e0f Textures: added texture list pointer in ImDrawData.
# Conflicts:
#	imgui.h
2025-06-11 15:12:02 +02:00
ocornut a21a2e855b Textures: Single Textures[] array allows backend to not have to care about atlases.
# Conflicts:
#	imgui.h
2025-06-11 15:05:49 +02:00
ocornut ee357aaddf Textures: Add ImTextureUserID_Invalid + introducing SetTexID().
Which gives us room for potentially updating ImDrawData during render.
2025-06-11 15:04:02 +02:00
ocornut 2cde9125d6 Fonts: Selecting font config source list done by shared code. 2025-06-11 15:04:02 +02:00
ocornut 191a728ecc (Breaking) added ImTextureRef struct. Changed ImDrawCmd::TextureId to TexRef.
Softly breaking. May require support from language binding generator.
Rebased and reworked completely on 2025/03/19.
2025-06-11 15:02:36 +02:00
ocornut b2f39318cb Adding .cache to ignore list. (#8674) 2025-06-11 13:41:06 +02:00
ocornut c3d7ada9df Demo: add indentation to simplify upcoming merges. 2025-06-04 22:27:34 +02:00
ocornut 91f72bbe1c Demo: omit ImGui:: prefix from ShowStyleEditor(), ShowUserGuide() code. 2025-06-04 21:29:12 +02:00
ocornut 9485aeb5c8 Demo: changed default framed item width to use Min(GetFontSize() * 12, GetContentRegionAvail().x * 0.40f). 2025-06-04 17:35:45 +02:00