Added stub for obsolete GetDefaultFontData() to help the user upgrading

This commit is contained in:
ocornut 2015-01-18 15:12:41 +00:00
parent a1c0c0e298
commit 56ac857cac
2 changed files with 17 additions and 3 deletions

View File

@ -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

View File

@ -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()