mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
imgui_freeetype: Updated suggested test code.
This commit is contained in:
parent
d972533d09
commit
db40699990
@ -67,6 +67,7 @@ struct FreeTypeTest
|
|||||||
FontBuildMode BuildMode;
|
FontBuildMode BuildMode;
|
||||||
bool WantRebuild;
|
bool WantRebuild;
|
||||||
float FontsMultiply;
|
float FontsMultiply;
|
||||||
|
int FontsPadding;
|
||||||
unsigned int FontsFlags;
|
unsigned int FontsFlags;
|
||||||
|
|
||||||
FreeTypeTest()
|
FreeTypeTest()
|
||||||
@ -74,6 +75,7 @@ struct FreeTypeTest
|
|||||||
BuildMode = FontBuildMode_FreeType;
|
BuildMode = FontBuildMode_FreeType;
|
||||||
WantRebuild = true;
|
WantRebuild = true;
|
||||||
FontsMultiply = 1.0f;
|
FontsMultiply = 1.0f;
|
||||||
|
FontsPadding = 1;
|
||||||
FontsFlags = 0;
|
FontsFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +87,10 @@ struct FreeTypeTest
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
for (int n = 0; n < io.Fonts->Fonts.Size; n++)
|
for (int n = 0; n < io.Fonts->Fonts.Size; n++)
|
||||||
{
|
{
|
||||||
io.Fonts->Fonts[n]->ConfigData->RasterizerMultiply = FontsMultiply;
|
ImFontConfig* font_config = (ImFontConfig*)io.Fonts->Fonts[n]->ConfigData;
|
||||||
io.Fonts->Fonts[n]->ConfigData->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00;
|
io.Fonts->TexGlyphPadding = FontsPadding;
|
||||||
|
font_config->RasterizerMultiply = FontsMultiply;
|
||||||
|
font_config->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00;
|
||||||
}
|
}
|
||||||
if (BuildMode == FontBuildMode_FreeType)
|
if (BuildMode == FontBuildMode_FreeType)
|
||||||
ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags);
|
ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags);
|
||||||
@ -105,6 +109,7 @@ struct FreeTypeTest
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb);
|
WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb);
|
||||||
WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f);
|
WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f);
|
||||||
|
WantRebuild |= ImGui::DragInt("Padding", &FontsPadding, 0.1f, 0, 16);
|
||||||
if (BuildMode == FontBuildMode_FreeType)
|
if (BuildMode == FontBuildMode_FreeType)
|
||||||
{
|
{
|
||||||
WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting);
|
WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting);
|
||||||
|
Loading…
Reference in New Issue
Block a user