imgui/misc/freetype
ocornut 9150c23c04 imgui_freetype: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly. (#5788, #5829)
This seemingly innocuous change sursingly had very large side-effects of completly breaking packing for the test font mentioned in above issue. Not even sure why tbh. New code matches what stb_truetype's stbtt_PackBegin() does.
2023-01-04 15:22:56 +01:00
..
imgui_freetype.cpp imgui_freetype: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly. (#5788, #5829) 2023-01-04 15:22:56 +01:00
imgui_freetype.h Freetype: Enable FreeType bitmap glyphs. (#3879) 2021-03-05 14:25:27 +01:00
README.md Changed FONT.md edit to blob (#5290) 2022-05-06 09:47:18 +02:00

imgui_freetype

Build font atlases using FreeType instead of stb_truetype (which is the default font rasterizer).
by @vuhdo, @mikesart, @ocornut.

Usage

  1. Get latest FreeType binaries or build yourself (under Windows you may use vcpkg with vcpkg install freetype --triplet=x64-windows, vcpkg integrate install).
  2. Add imgui_freetype.h/cpp alongside your project files.
  3. Add #define IMGUI_ENABLE_FREETYPE in your imconfig.h file

About Gamma Correct Blending

FreeType assumes blending in linear space rather than gamma space. See FreeType note for FT_Render_Glyph. For correct results you need to be using sRGB and convert to linear space in the pixel shader output. The default Dear ImGui styles will be impacted by this change (alpha values will need tweaking).

Testbed for toying with settings (for developers)

See https://gist.github.com/ocornut/b3a9ecf13502fd818799a452969649ad

Known issues

  • Oversampling settins are ignored but also not so much necessary with the higher quality rendering.

Comparaison

Small, thin anti-aliased fonts typically benefit a lot from FreeType's hinting: comparing_font_rasterizers

Colorful glyphs/emojis

You can use the ImGuiFreeTypeBuilderFlags_LoadColor flag to load certain colorful glyphs. See the "Using Colorful Glyphs/Emojis" section of FONTS.md.

colored glyphs