(Breaking) Removed atlas->TexDesiredWidth now unnecessary (github 327)

This commit is contained in:
ocornut
2024-11-29 17:22:33 +01:00
committed by ocornut
parent b670f799d5
commit 4f27792ffe
3 changed files with 3 additions and 4 deletions

View File

@@ -60,7 +60,6 @@ Some solutions:
- Reduce glyphs ranges by calculating them from source localization data. - Reduce glyphs ranges by calculating them from source localization data.
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! 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. - Set `io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;` to disable rounding the texture height to the next power of two.
- Set `io.Fonts.TexDesiredWidth` to specify a texture width to reduce maximum texture height (see comment in `ImFontAtlas::Build()` function).
Future versions of Dear ImGui should solve this problem. Future versions of Dear ImGui should solve this problem.

View File

@@ -3626,6 +3626,7 @@ struct ImFontAtlas
float _PackNodesFactor = 1.0f; float _PackNodesFactor = 1.0f;
// [Obsolete] // [Obsolete]
//int TexDesiredWidth; // OBSOLETED in 1.91.5 (force texture width before calling Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height)
//typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ //typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+
//typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+ //typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+
}; };

View File

@@ -3634,9 +3634,8 @@ void ImFontAtlasBuildGrowTexture(ImFontAtlas* atlas, int old_tex_w, int old_tex_
if (old_tex_h == -1) if (old_tex_h == -1)
old_tex_h = atlas->TexData->Height; old_tex_h = atlas->TexData->Height;
// FIXME-NEWATLAS-V1: Handle atlas->TexDesiredWidth from user? // FIXME-NEWATLAS-V2: What to do when reaching limits exposed by backend?
// FIXME-NEWATLAS-V1: What to do when reaching limits exposed by backend? // FIXME-NEWATLAS-V2: does ImFontAtlasFlags_NoPowerOfTwoHeight makes sense now? Allow 'lock' and 'compact' operations?
// FIXME-NEWATLAS-V1: does ImFontAtlasFlags_NoPowerOfTwoHeight makes sense now? Allow 'lock' and 'compact' operations?
IM_ASSERT(ImIsPowerOfTwo(old_tex_w) && ImIsPowerOfTwo(old_tex_h)); IM_ASSERT(ImIsPowerOfTwo(old_tex_w) && ImIsPowerOfTwo(old_tex_h));
// Grow texture so it follows roughly a square. // Grow texture so it follows roughly a square.