mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Demo: Added "Widgets/Text/Different Size Text" section to show font system changes in v1.92. (#8738)
This commit is contained in:
parent
fff47f1119
commit
9fbe560218
1 changed files with 29 additions and 0 deletions
|
|
@ -3548,6 +3548,35 @@ static void DemoWindowWidgetsText()
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IMGUI_DEMO_MARKER("Widgets/Text/Different Size Text");
|
||||||
|
if (ImGui::TreeNode("Different Size Text"))
|
||||||
|
{
|
||||||
|
const ImGuiStyle& style = ImGui::GetStyle();
|
||||||
|
|
||||||
|
for (float scaling = 0.5f; scaling < 4.01f; scaling += 0.5f)
|
||||||
|
{
|
||||||
|
ImGui::PushFont(nullptr, style.FontSizeBase * scaling);
|
||||||
|
ImGui::Text("Text size is %.1f (style.FontSizeBase * %.1f)", style.FontSizeBase * scaling, scaling);
|
||||||
|
ImGui::PopFont();
|
||||||
|
}
|
||||||
|
|
||||||
|
static float custom_scaling{ 1.0f };
|
||||||
|
ImGui::SliderFloat("Custom Scaling##Different Size Text", &custom_scaling, 0.5f, 4.0f, "%.1f");
|
||||||
|
ImGui::SameLine(); HelpMarker("ImGui::PushFont(nullptr, style.FontSizeBase * custom_scaling);");
|
||||||
|
ImGui::PushFont(nullptr, style.FontSizeBase * custom_scaling);
|
||||||
|
ImGui::Text("Text size is %.1f (style.FontSizeBase * %.1f)", style.FontSizeBase * custom_scaling, custom_scaling);
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
static float custom_font_size{ 16.0f };
|
||||||
|
ImGui::SliderFloat("Custom Font Size##Different Size Text", &custom_font_size, 10.0f, 100.0f, "%.1f");
|
||||||
|
ImGui::SameLine(); HelpMarker("ImGui::PushFont(nullptr, custom_font_size);");
|
||||||
|
ImGui::PushFont(nullptr, custom_font_size);
|
||||||
|
ImGui::Text("Text size is %.1f", custom_font_size);
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Widgets/Text/Word Wrapping");
|
IMGUI_DEMO_MARKER("Widgets/Text/Word Wrapping");
|
||||||
if (ImGui::TreeNode("Word Wrapping"))
|
if (ImGui::TreeNode("Word Wrapping"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue