From 56ac857cac3889b9208d23c0ae1547c808c37547 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 18 Jan 2015 15:12:41 +0000 Subject: [PATCH] Added stub for obsolete GetDefaultFontData() to help the user upgrading --- imgui.cpp | 17 ++++++++++++++--- imgui.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index d7687310..ae777454 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -185,18 +185,18 @@ If you want to load a different font than the default (ProggyClean.ttf, size 13) io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); - io.Fonts->GetTexDataAs****() + io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() If you want to load multiple fonts, use the font atlas to pack them into a single texture! ImFont* font0 = io.Fonts->AddFontDefault(); ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); - io.Fonts->GetTexDataAs****() + io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() If you want to display Chinese, Japanese, Korean characters, pass custom Unicode ranges when loading a font: io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, io.Fonts->GetGlyphRangesJapanese()); // Load Japanese characters - io.Fonts->GetTexDataAs****() + io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() If you want to input Japanese/Chinese/Korean in the text input widget: @@ -6359,6 +6359,17 @@ void ImFontAtlas::Clear() Fonts.clear(); } +void ImGui::GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size) +{ + printf("GetDefaultFontData() is obsoleted in ImGui 1.30.\n"); + printf("Please use ImGui::GetIO().Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() functions to retrieve uncompressed texture data.\n"); + if (fnt_data) *fnt_data = NULL; + if (fnt_size) *fnt_size = 0; + if (png_data) *png_data = NULL; + if (png_size) *png_size = 0; + IM_ASSERT(false); +} + void ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel) { // Lazily build diff --git a/imgui.h b/imgui.h index cd442b8f..e845c158 100644 --- a/imgui.h +++ b/imgui.h @@ -320,6 +320,9 @@ namespace ImGui IMGUI_API const char* GetStyleColName(ImGuiCol idx); IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); + // Obsolete (will be removed) + IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); + } // namespace ImGui // Flags for ImGui::Begin()