imgui_freetype.h
Go to the documentation of this file.
1 // Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui
2 // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype
3 // Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut
4 
5 #pragma once
6 
7 #include "imgui.h" // IMGUI_API, ImFontAtlas
8 
9 namespace ImGuiFreeType
10 {
11  // Hinting greatly impacts visuals (and glyph sizes).
12  // When disabled, FreeType generates blurrier glyphs, more or less matches the stb's output.
13  // The Default hinting mode usually looks good, but may distort glyphs in an unusual way.
14  // The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer.
15 
16  // You can set those flags on a per font basis in ImFontConfig::RasterizerFlags.
17  // Use the 'extra_flags' parameter of BuildFontAtlas() to force a flag on all your fonts.
19  {
20  // By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter.
21  NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
22  NoAutoHint = 1 << 1, // Disable auto-hinter.
23  ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter.
24  LightHinting = 1 << 3, // 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.
25  MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
26  Bold = 1 << 5, // Styling: Should we artificially embolden the font?
27  Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style?
28  Monochrome = 1 << 7 // Disable anti-aliasing. Combine this with MonoHinting for best results!
29  };
30 
31  IMGUI_API bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags = 0);
32 
33  // By default ImGuiFreeType will use IM_ALLOC()/IM_FREE().
34  // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired:
35  IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = NULL);
36 }
ImGuiFreeType::Monochrome
@ Monochrome
Definition: imgui_freetype.h:28
NULL
NULL
Definition: test_security_zap.cpp:405
ImGuiFreeType::MonoHinting
@ MonoHinting
Definition: imgui_freetype.h:25
ImGuiFreeType::NoAutoHint
@ NoAutoHint
Definition: imgui_freetype.h:22
ImGuiFreeType
Definition: imgui_freetype.h:9
imgui.h
ImGuiFreeType::NoHinting
@ NoHinting
Definition: imgui_freetype.h:21
ImFontAtlas
Definition: imgui.h:2182
ImGuiFreeType::SetAllocatorFunctions
IMGUI_API void SetAllocatorFunctions(void *(*alloc_func)(size_t sz, void *user_data), void(*free_func)(void *ptr, void *user_data), void *user_data=NULL)
Definition: imgui_freetype.cpp:676
ImGuiFreeType::Bold
@ Bold
Definition: imgui_freetype.h:26
ImGuiFreeType::BuildFontAtlas
IMGUI_API bool BuildFontAtlas(ImFontAtlas *atlas, unsigned int extra_flags=0)
Definition: imgui_freetype.cpp:652
ImGuiFreeType::LightHinting
@ LightHinting
Definition: imgui_freetype.h:24
ImGuiFreeType::ForceAutoHint
@ ForceAutoHint
Definition: imgui_freetype.h:23
ImGuiFreeType::RasterizerFlags
RasterizerFlags
Definition: imgui_freetype.h:18
IMGUI_API
#define IMGUI_API
Definition: imgui.h:70
ImGuiFreeType::Oblique
@ Oblique
Definition: imgui_freetype.h:27


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54