diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 3e51e2ddc..ee7e3f28f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -37,7 +37,9 @@ HOW TO UPDATE? Breaking Changes: -- imgui_freetype: Removed ImGuiFreeType::BuildFontAtlas() extra flags, now stored in ImFontAtlas::FontBuilderFlags. +- imgui_freetype: Removed ImGuiFreeType::BuildFontAtlas(). Kept inline redirection function. + Prefer using '#define IMGUI_ENABLE_FREETYPE', but there's a runtime selection path available too. + The shared extra flags parameters (very rarely used) are now stored in ImFontAtlas::FontBuilderFlags. - imgui_freetype: Renamed ImFontConfig::RasterizerFlags (used by FreeType) to ImFontConfig::FontBuilderFlags. - imgui_freetyoe: Renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API. diff --git a/imgui.cpp b/imgui.cpp index b4e9574a5..380df5702 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -373,7 +373,7 @@ CODE When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. - - 2021/01/26 (1.81) - imgui_freetype: removed ImGuiFreeType::BuildFontAtlas() extra flags, now stored in ImFontAtlas::FontBuilderFlags. + - 2021/01/26 (1.81) - imgui_freetype: removed ImGuiFreeType::BuildFontAtlas(). Kept inline redirection function. Prefer using '#define IMGUI_ENABLE_FREETYPE', but there's a runtime selection path available too. The shared extra flags parameters (very rarely used) are now stored in ImFontAtlas::FontBuilderFlags. - imgui_freetype: renamed ImFontConfig::RasterizerFlags (used by FreeType) to ImFontConfig::FontBuilderFlags. - imgui_freetype: renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API. - 2020/10/12 (1.80) - removed redirecting functions/enums that were marked obsolete in 1.63 (August 2018): diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 83ee4efd9..8d52ea356 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -4249,7 +4249,7 @@ static void ShowDemoWindowTables() ImGui::TableHeadersRow(); ImGui::TableNextColumn(); - ImGui::Text("A0 Cell 0"); + ImGui::Text("A0 Row 0"); { float rows_height = TEXT_BASE_HEIGHT * 2; if (ImGui::BeginTable("table_nested2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable)) @@ -4260,21 +4260,21 @@ static void ShowDemoWindowTables() ImGui::TableNextRow(ImGuiTableRowFlags_None, rows_height); ImGui::TableNextColumn(); - ImGui::Text("B0 Cell 0"); + ImGui::Text("B0 Row 0"); ImGui::TableNextColumn(); - ImGui::Text("B0 Cell 1"); + ImGui::Text("B1 Row 0"); ImGui::TableNextRow(ImGuiTableRowFlags_None, rows_height); ImGui::TableNextColumn(); - ImGui::Text("B1 Cell 0"); + ImGui::Text("B0 Row 1"); ImGui::TableNextColumn(); - ImGui::Text("B1 Cell 1"); + ImGui::Text("B1 Row 1"); ImGui::EndTable(); } } - ImGui::TableNextColumn(); ImGui::Text("A0 Cell 1"); - ImGui::TableNextColumn(); ImGui::Text("A1 Cell 0"); - ImGui::TableNextColumn(); ImGui::Text("A1 Cell 1"); + ImGui::TableNextColumn(); ImGui::Text("A1 Row 0"); + ImGui::TableNextColumn(); ImGui::Text("A0 Row 1"); + ImGui::TableNextColumn(); ImGui::Text("A1 Row 1"); ImGui::EndTable(); } ImGui::TreePop(); diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 06cf06d9f..ad106c3c0 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2447,7 +2447,7 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opa } } -void ImFontAtlasBuildRender1bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value) +void ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value) { IM_ASSERT(x >= 0 && x + w <= atlas->TexWidth); IM_ASSERT(y >= 0 && y + h <= atlas->TexHeight); @@ -2469,8 +2469,8 @@ static void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas) IM_ASSERT(r->Width == FONT_ATLAS_DEFAULT_TEX_DATA_W * 2 + 1 && r->Height == FONT_ATLAS_DEFAULT_TEX_DATA_H); const int x_for_white = r->X; const int x_for_black = r->X + FONT_ATLAS_DEFAULT_TEX_DATA_W + 1; - ImFontAtlasBuildRender1bppRectFromString(atlas, x_for_white, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, '.', 0xFF); - ImFontAtlasBuildRender1bppRectFromString(atlas, x_for_black, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, 'X', 0xFF); + ImFontAtlasBuildRender8bppRectFromString(atlas, x_for_white, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, '.', 0xFF); + ImFontAtlasBuildRender8bppRectFromString(atlas, x_for_black, r->Y, FONT_ATLAS_DEFAULT_TEX_DATA_W, FONT_ATLAS_DEFAULT_TEX_DATA_H, FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS, 'X', 0xFF); } else { diff --git a/imgui_internal.h b/imgui_internal.h index 0747b7cd4..1c961617a 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2509,7 +2509,7 @@ IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas); IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque); IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); -IMGUI_API void ImFontAtlasBuildRender1bppRectFromString(ImFontAtlas* atlas, int atlas_x, int atlas_y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value); +IMGUI_API void ImFontAtlasBuildRender8bppRectFromString(ImFontAtlas* atlas, int atlas_x, int atlas_y, int w, int h, const char* in_str, char in_marker_char, unsigned char in_marker_pixel_value); IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor); IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride); diff --git a/misc/freetype/imgui_freetype.h b/misc/freetype/imgui_freetype.h index a108d4fbe..2b953f2f2 100644 --- a/misc/freetype/imgui_freetype.h +++ b/misc/freetype/imgui_freetype.h @@ -39,4 +39,10 @@ namespace ImGuiFreeType // Override allocators. By default ImGuiFreeType will use IM_ALLOC()/IM_FREE() // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired. 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); + + // Obsolete names (will be removed soon) + // Prefer using '#define IMGUI_ENABLE_FREETYPE' +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int flags = 0) { atlas->FontBuilderIO = GetBuilderForFreeType(); atlas->FontBuilderFlags = flags; return atlas->Build(); } +#endif }