Skip to content

Commit 2fd411a

Browse files
DonKultocornut
authored andcommitted
Support custom stb_rect_pack filename in Freetype (ocornut#3062)
Copies the #define magic from imgui_draw.cpp to the imgui_freetype implementation to allow the use of a custom stb rect_pack here as well. References: fe5347e
1 parent 75a65f6 commit 2fd411a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docs/CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Other Changes:
5757
- Window: Fixed a bug with child window inheriting ItemFlags from their parent when the child
5858
window also manipulate the ItemFlags stack. (#3024) [@Stanbroek]
5959
- Font: Fixed non-ASCII space occasionally creating unnecessary empty polygons.
60+
- Misc, Freetype: Fixed support for IMGUI_STB_RECT_PACK_FILENAME compile time directive
61+
in imgui_freetype.cpp (matching support in the regular code path). (#3062) [@DonKult]
6062
- Demo: Added black and white and color gradients to Demo>Examples>Custom Rendering.
6163
- CI: Added more tests on the continuous-integration server: extra warnings for Clang/GCC, building
6264
SDL+Metal example, and more compile-time imconfig.h settings: disabling obsolete functions,

misc/freetype/imgui_freetype.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,18 @@ namespace
278278
}
279279
}
280280

281-
#ifndef STB_RECT_PACK_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)
282-
#define STBRP_ASSERT(x) IM_ASSERT(x)
281+
#ifndef STB_RECT_PACK_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)
282+
#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
283+
#define STBRP_ASSERT(x) IM_ASSERT(x)
283284
#define STBRP_STATIC
284285
#define STB_RECT_PACK_IMPLEMENTATION
286+
#endif
287+
#ifdef IMGUI_STB_RECT_PACK_FILENAME
288+
#include IMGUI_STB_RECT_PACK_FILENAME
289+
#else
285290
#include "imstb_rectpack.h"
286291
#endif
292+
#endif
287293

288294
struct ImFontBuildSrcGlyphFT
289295
{

0 commit comments

Comments
 (0)