Browse Source

Fonts: added notes/comments and dummy type about renaming ImFontBuilderIO::GetBuilderForFreeType() to ImFontLoader::GetFontLoader().

ocornut 4 months ago
parent
commit
92ff153763
2 changed files with 8 additions and 2 deletions
  1. 3 0
      imgui_internal.h
  2. 5 2
      misc/freetype/imgui_freetype.h

+ 3 - 0
imgui_internal.h

@@ -3699,6 +3699,9 @@ struct ImFontLoader
 #ifdef IMGUI_ENABLE_STB_TRUETYPE
 IMGUI_API const ImFontLoader* ImFontAtlasGetFontLoaderForStbTruetype();
 #endif
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+typedef ImFontLoader ImFontBuilderIO; // [renamed/changed in 1.92] The types are not actually compatible but we provide this as a compile-time error report helper.
+#endif
 
 //-----------------------------------------------------------------------------
 // [SECTION] ImFontAtlas internal API

+ 5 - 2
misc/freetype/imgui_freetype.h

@@ -6,7 +6,9 @@
 #ifndef IMGUI_DISABLE
 
 // Usage:
-// - Add '#define IMGUI_ENABLE_FREETYPE' in your imconfig to enable support for imgui_freetype in imgui.
+// - Add '#define IMGUI_ENABLE_FREETYPE' in your imconfig to automatically enable support
+//   for imgui_freetype in imgui. It is equivalent to selecting the default loader with:
+//      io.Fonts.FontLoader = ImGuiFreeType::GetFontLoader()
 
 // Optional support for OpenType SVG fonts:
 // - Add '#define IMGUI_ENABLE_FREETYPE_PLUTOSVG' to use plutosvg (not provided). See #7927.
@@ -52,8 +54,9 @@ namespace ImGuiFreeType
     // Display UI to edit FontBuilderFlags in ImFontAtlas (shared) or ImFontConfig (single source)
     IMGUI_API bool                      DebugEditFontBuilderFlags(unsigned int* p_font_loader_flags);
 
-    // Obsolete names (will be removed soon)
+    // Obsolete names (will be removed)
 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+    //IMGUI_API const ImFontBuilderIO* GetBuilderForFreeType(); // Renamed/changed in 1.92. Change 'io.Fonts->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType()' to 'io.Fonts.FontLoader = ImGuiFreeType::GetFontLoader()' if you need runtime selection.
     //static inline bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int flags = 0) { atlas->FontBuilderIO = GetBuilderForFreeType(); atlas->FontBuilderFlags = flags; return atlas->Build(); } // Prefer using '#define IMGUI_ENABLE_FREETYPE'
 #endif
 }