From db40699990928b95584dbab953a2b1a179f48f7e Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 18 Feb 2019 12:08:19 +0100 Subject: [PATCH] imgui_freeetype: Updated suggested test code. --- misc/freetype/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/misc/freetype/README.md b/misc/freetype/README.md index 156e6511..4c53cd9c 100644 --- a/misc/freetype/README.md +++ b/misc/freetype/README.md @@ -67,6 +67,7 @@ struct FreeTypeTest FontBuildMode BuildMode; bool WantRebuild; float FontsMultiply; + int FontsPadding; unsigned int FontsFlags; FreeTypeTest() @@ -74,6 +75,7 @@ struct FreeTypeTest BuildMode = FontBuildMode_FreeType; WantRebuild = true; FontsMultiply = 1.0f; + FontsPadding = 1; FontsFlags = 0; } @@ -85,8 +87,10 @@ struct FreeTypeTest ImGuiIO& io = ImGui::GetIO(); for (int n = 0; n < io.Fonts->Fonts.Size; n++) { - io.Fonts->Fonts[n]->ConfigData->RasterizerMultiply = FontsMultiply; - io.Fonts->Fonts[n]->ConfigData->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00; + ImFontConfig* font_config = (ImFontConfig*)io.Fonts->Fonts[n]->ConfigData; + io.Fonts->TexGlyphPadding = FontsPadding; + font_config->RasterizerMultiply = FontsMultiply; + font_config->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00; } if (BuildMode == FontBuildMode_FreeType) ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags); @@ -105,6 +109,7 @@ struct FreeTypeTest ImGui::SameLine(); WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb); WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f); + WantRebuild |= ImGui::DragInt("Padding", &FontsPadding, 0.1f, 0, 16); if (BuildMode == FontBuildMode_FreeType) { WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting);