feat(api): make FreeType a toggleable option which is disabled by default (#254)

* deps(build): bump FreeType from 2.12.1 to 2.13.3

* fix(generator): add missing ImGuiFreeTypeBuilderFlags

* feat(generator): add possibility to provide additional defines specifically for AST

* feat(api): make FreeType optional and disabled by default

FreeType renderer is still included in the final build.
Its usage is toggleable and DISABLED by default.
This commit is contained in:
SpaiR authored and GitHub committed 2024-08-18 10:45:27 +03:00
1 parent 887e3d9c85
commit d252c145c5
15 files changed
+370 -10

No files matched your search

@@ -137,6 +137,32 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
// Building in RGBA32 format is provided for convenience and compatibility, but note that unless you manually manipulate or copy color data into
// the texture (e.g. when using the AddCustomRect*** api), then the RGB pixels emitted will always be white (~75% of memory/bandwidth waste.
/*JNI
#ifdef IMGUI_ENABLE_FREETYPE
#include "misc/freetype/imgui_freetype.h"
#endif
*/
/**
* <b>BINDING NOTICE:</b> This method is specific to the imgui-java binding.
* <p>
* Since FreeType is included in the final build, it's possible to use both font renderers (STB_TrueType and FreeType) simultaneously without needing to rebuild the library.
* By default, we use small hacks to set STB_TrueType as the default font renderer. However, this method allows you to enforce the use of the FreeType renderer.
* <p>
* This method MUST be called before invoking the "#build" or "#getTexData*" methods.
*
* @param enabled true to enable the FreeType font renderer
*/
public native void setFreeTypeRenderer(boolean enabled); /*
#ifdef IMGUI_ENABLE_FREETYPE
if (enabled) {
THIS->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType();
} else {
THIS->FontBuilderIO = NULL;
}
#endif
*/
/**
* Build pixels data. This is called automatically for you by the GetTexData*** functions.
*/
@@ -8,6 +8,6 @@ public final class ImGuiFreeTypeBuilderFlags {
private ImGuiFreeTypeBuilderFlags() {
}
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiFreeTypeBuilderFlags_")
@BindingAstEnum(file = "ast-imgui_freetype.json", qualType = "ImGuiFreeTypeBuilderFlags", sanitizeName = "ImGuiFreeTypeBuilderFlags_")
public Void __;
}
+3 -1
View File
@@ -13,6 +13,7 @@
//-----------------------------------------------------------------------------
#pragma once
#include "jni_assertion.h"
//---- Define assertion handler. Defaults to calling assert().
@@ -30,6 +31,7 @@
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
//---- Disable all of Dear ImGui or don't implement standard windows.
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
@@ -77,7 +79,7 @@
//---- Use stb_truetype to build and rasterize the font atlas (default)
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
//#define IMGUI_ENABLE_STB_TRUETYPE
#define IMGUI_ENABLE_STB_TRUETYPE
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
// This will be inlined as part of ImVec2 and ImVec4 class declarations.