From 045a0907f4824ed3bfdb95bc8721f197f7d9734e Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 2 Jun 2026 18:05:23 +0200 Subject: [PATCH] Docs: Fonts.md: added notes about TexMinWidth,TexMinHeight. Probably misplaced: the document could have a section about memory usage considerations? --- docs/FONTS.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/FONTS.md b/docs/FONTS.md index 1e51cde48..f0fbd85f9 100644 --- a/docs/FONTS.md +++ b/docs/FONTS.md @@ -77,6 +77,17 @@ Some solutions: You can use the `ImFontGlyphRangesBuilder` for this purpose and rebuilding your atlas between frames when new characters are needed. This will be the biggest win! - Set `io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;` to disable rounding the texture height to the next power of two. +### (5) Reduce texture resizes/copy on startup + +🆕 Since 1.92, the ImFontAtlas is initially created using a 512x128 texture, then grows as glyphs and fonts are registered. Growth leads to a copy, and both the old and new sized textures are present in memory. If you use known fonts and want to reduce initial growth, you may set `TexMinWidth` and `TexMinHeight` during initializaton. + +```cpp +ImFontAtlas* atlas = io.Fonts; +atlas->TexMinWidth = 1024; +atlas->TexMinHeight = 1024; +atlas->AddFont(...); +``` + ##### [Return to Index](#index) ---------------------------------------