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:
1 parent
887e3d9c85
commit
d252c145c5
15 files changed
+370
-10
No files matched your search
@@ -460,6 +460,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.
|
||||
*/
|
||||
|
||||
@@ -5,5 +5,73 @@ public final class ImGuiFreeTypeBuilderFlags {
|
||||
private ImGuiFreeTypeBuilderFlags() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
|
||||
*
|
||||
* <p>Definition: {@code 1 << 0}
|
||||
*/
|
||||
public static final int NoHinting = 1;
|
||||
|
||||
/**
|
||||
* Disable auto-hinter.
|
||||
*
|
||||
* <p>Definition: {@code 1 << 1}
|
||||
*/
|
||||
public static final int NoAutoHint = 2;
|
||||
|
||||
/**
|
||||
* Indicates that the auto-hinter is preferred over the font's native hinter.
|
||||
*
|
||||
* <p>Definition: {@code 1 << 2}
|
||||
*/
|
||||
public static final int ForceAutoHint = 4;
|
||||
|
||||
/**
|
||||
* A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
|
||||
*
|
||||
* <p>Definition: {@code 1 << 3}
|
||||
*/
|
||||
public static final int LightHinting = 8;
|
||||
|
||||
/**
|
||||
* Strong hinting algorithm that should only be used for monochrome output.
|
||||
*
|
||||
* <p>Definition: {@code 1 << 4}
|
||||
*/
|
||||
public static final int MonoHinting = 16;
|
||||
|
||||
/**
|
||||
* Styling: Should we artificially embolden the font?
|
||||
*
|
||||
* <p>Definition: {@code 1 << 5}
|
||||
*/
|
||||
public static final int Bold = 32;
|
||||
|
||||
/**
|
||||
* Styling: Should we slant the font, emulating italic style?
|
||||
*
|
||||
* <p>Definition: {@code 1 << 6}
|
||||
*/
|
||||
public static final int Oblique = 64;
|
||||
|
||||
/**
|
||||
* Disable anti-aliasing. Combine this with MonoHinting for best results!
|
||||
*
|
||||
* <p>Definition: {@code 1 << 7}
|
||||
*/
|
||||
public static final int Monochrome = 128;
|
||||
|
||||
/**
|
||||
* Enable FreeType color-layered glyphs
|
||||
*
|
||||
* <p>Definition: {@code 1 << 8}
|
||||
*/
|
||||
public static final int LoadColor = 256;
|
||||
|
||||
/**
|
||||
* Enable FreeType bitmap glyphs
|
||||
*
|
||||
* <p>Definition: {@code 1 << 9}
|
||||
*/
|
||||
public static final int Bitmap = 512;
|
||||
}
|
||||
Reference in new issue
Block a user