Commit graph

3236 commits

Author SHA1 Message Date
ocornut
a6b57f4d76 WIP - Extract ImFontAtlasBuildGetFontBaked() out of ImFont::GetFontBaked() mostly for consistency with upcoming changes + tweak locals in AddFont().
Some checks are pending
build / Windows (push) Waiting to run
build / Linux (push) Waiting to run
build / MacOS (push) Waiting to run
build / iOS (push) Waiting to run
build / Emscripten (push) Waiting to run
build / Android (push) Waiting to run
# Conflicts:
#	imgui_draw.cpp
2025-04-18 15:39:31 +02:00
ocornut
72ee77b919 WIP - Fonts: encode additional data in ImFontAtlasRectId to detect invalid id + added Rects debug browser. 2025-04-14 16:00:04 +02:00
ocornut
0a7c05cc43 WIP - Fonts: do not mark whole ImTextureData struct as IMGUI_API to fix warning when used in ImVector<> (8559) 2025-04-10 17:34:04 +02:00
ocornut
6d6a8bbf49 WIP - Fonts: add optional out parameter to AddCustomRect() 2025-04-10 17:34:04 +02:00
ocornut
fcaf9c11c0 WIP - Fonts: added RemoveCustomRect().
+ internally add ImFontAtlasPackReuseRectEntry()
2025-04-10 17:34:04 +02:00
ocornut
7c6cb48328 WIP - Fonts: moved ImFontAtlasRectId back to public API. 2025-04-10 17:34:03 +02:00
ocornut
50d0d0195d WIP - Fonts: (Breaking) rework GetCustomRect() api. Reintroduce ImFontAtlasRect. 2025-04-10 17:34:03 +02:00
ocornut
6dfae021cf WIP - Fonts: (Breaking) renamed AddCustomRectRegular() -> AddCustomRect(). 2025-04-10 17:34:03 +02:00
ocornut
a177a68a31 WIP - Fonts: Comments.
comments

comments
2025-04-10 17:34:03 +02:00
ocornut
3273162de9 WIP - (Breaking) Fonts: PushFont() default to preserve current font size. 2025-04-10 17:34:03 +02:00
ocornut
836e812cd0 WIP - Fonts: awkwardly alias old TexID name to TexRef using an union (may backtrack and just keep old name) 2025-04-10 17:34:03 +02:00
ocornut
9ee53ebda0 WIP - Fonts: avoid both ImTextureRef being set simultaneously. 2025-04-10 17:34:03 +02:00
ocornut
a2b87540c1 WIP - Fonts: comments, tweaks, minor amends.
Comments, tweaks
2025-04-10 17:34:03 +02:00
ocornut
b7040a3fbc WIP - Fonts: fixed ImTextureID() being zero-cleared instead of using ImTextureUserID_Invalid. . 2025-04-10 17:34:02 +02:00
ocornut
293f0f9980 WIP - Fonts: Added ImTextureRef::GetTexID() mostly for consistency. 2025-04-10 17:34:02 +02:00
ocornut
f376ca6b30 WIP - (Breaking) Fonts: renamed CalcCustomRectUV() to GetCustomRectUV() for simplicity. 2025-04-10 17:34:02 +02:00
ocornut
6cc4899ec4 WIP - (Breaking) Fonts: rename GetCustomRectByIndex() to GetCustomRect(). Made return struct const. 2025-04-10 17:34:02 +02:00
ocornut
15eb5adccd WIP - Fonts: narrowed invalid value for ImFontAtlasRectId to -1 a we will change implementation. 2025-04-10 17:34:02 +02:00
ocornut
f871e628e9 WIP - Fonts: fixed memory leaks, shutting down font loader, and on AddFont() failure in Freetype backend. 2025-04-10 17:34:02 +02:00
ocornut
282559d77a WIP - ImFontConfig::GlyphExcludeRanges is owner and copied. 2025-04-10 17:34:01 +02:00
ocornut
4aed437c72 WIP - Obsolete GetGlyphRangesXXX() functions. 2025-04-10 17:34:01 +02:00
ocornut
d467bcb1ba WIP - Fixed various small warnings / build issues. 2025-04-10 17:34:01 +02:00
ocornut
871759cdaf WIP - Added a ImFontFlags_NoLoadError flag to let user code try file paths. (3611) 2025-04-10 17:34:01 +02:00
ocornut
ead3b7300c WIP - Added ImTextureData::UsedRect. 2025-04-10 17:34:01 +02:00
ocornut
2d4631bf71 WIP - Removed LockSingleSrcConfigIdx which isn't needed anymore since we don't load glyphs in ImFontAtlasBuildAddFont(). 2025-04-10 17:34:00 +02:00
ocornut
dbda463113 WIP - Fallback glyph is now lazily loaded on demand (yay!). Moving ImFontBaked:: functions outside of class. 2025-04-10 17:34:00 +02:00
ocornut
c45f004f05 WIP - A font source can specify its own loader/backend. 2025-04-10 17:34:00 +02:00
ocornut
5f66e54777 WIP - 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-04-10 17:34:00 +02:00
ocornut
981f63f37e WIP - Reinstated ImFontAtlasBuildSetupFontCreateEllipsisFromDot() compatible with baked system, lazily baked. 2025-04-10 17:34:00 +02:00
ocornut
9e32ac1998 WIP - ImFontFlags: ImFontFlags_NoLoadGlyphs + add ImFontFlags_LockBakedSizes 2025-04-10 17:34:00 +02:00
ocornut
36538440c5 WIP - Exposed CompactCache(). Hide ClearCache(). 2025-04-10 17:34:00 +02:00
ocornut
98d8e7007a WIP - Restore a functional AddCustomRectFontGlyph(). 2025-04-10 17:34:00 +02:00
ocornut
985eb5403d WIP - ImFontConfig: added GlyphExcludeRanges 2025-04-10 17:34:00 +02:00
ocornut
505379e490 WIP - Reordered ImFont fields. 2025-04-10 17:33:59 +02:00
ocornut
3d750d2429 WIP - Baked system, v12: support GlyphOffset / GlyphMinAdvanceX / GlyphMaxAdvanceX by scaling from ref value.
Overwriting cfg->PixelSnapH = true; in imgui_freetype is weird.
2025-04-10 17:33:59 +02:00
ocornut
b0f7e01981 WIP - Comments around ImTextureUserID/ImTextureID types. 2025-04-10 17:33:59 +02:00
ocornut
4ca8254b7b WIP - Added PushFontSize(), PopFontSize() api. Added font_size param to PushFont() as well. 2025-04-10 17:33:59 +02:00
ocornut
b9b8efc8bc WIP - Clarify ClearTexData() as not supported with dynamic atlases. 2025-04-10 17:33:59 +02:00
ocornut
fcae19c28e WIP - Baked system, with auto-bind, v10. 2025-04-10 17:33:59 +02:00
ocornut
45a5f9e103 (Breaking) CalcWordWrapPositionA() -> CalcWordWrapPosition(), takes size instead of scale as this will be needed. 2025-04-10 17:33:59 +02:00
ocornut
09cb4e240e WIP - Removed BuildClearGlyphs(), conflated with ClearOutputData() 2025-04-10 17:33:58 +02:00
ocornut
fdfbd4f280 WIP - 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-04-10 17:33:58 +02:00
ocornut
31305ba1c0 WIP - (Breaking) remove ImFontAtlasCustomRect which is now the same as ImTextureRect 2025-04-10 17:33:58 +02:00
ocornut
95bf095244 WIP - Added back support for AddCustomRectFontGlyph()
Legacy path naturally works.
2025-04-10 17:33:58 +02:00
ocornut
90d5ac7343 WIP - Comments, remove ImFontAtlas facing BuildGrowTexture(), BuildCompactTexture(). Make IsBuilt() obsolete. 2025-04-10 17:33:58 +02:00
ocornut
9619e44780 WIP - Basic heuristic to repack instead of growing. Moved rects count/surface to internals. 2025-04-10 17:33:58 +02:00
ocornut
ca3761f7db WIP - Added atlas's TexMinWidth/TexMinHeight/TexMaxWidth/TexMaxHeight.
Fixed ImFontAtlasBuildGetTextureSizeEstimate().
Basic error handling on OOM.
2025-04-10 17:33:58 +02:00
ocornut
f9dd85b9a5 WIP - Turn public facing BuildRegisterGlyph() into ImFontAtlasBuildAddFontGlyph() thats sets up UV. 2025-04-10 17:33:57 +02:00
ocornut
773604a666 WIP - Rasterizing ellipsis character from dot as one glyph + avoid preloading if it not needed. 2025-04-10 17:33:57 +02:00
ocornut
c10b8741af WIP - Fixed support for multiple contexts. 2025-04-10 17:33:57 +02:00