mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Fonts: added ImGuiStyle::FontSizeBase. Ensuring PushFontSize() works before main loop and across NewFrame().
# Conflicts: # imgui.cpp
This commit is contained in:
parent
b029be6b6c
commit
1e118ab891
5 changed files with 125 additions and 56 deletions
|
|
@ -430,16 +430,25 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||
ImGui::Text("dear imgui says hello! (%s) (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM);
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::SeparatorText("dynamic_fonts branch");
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 5);
|
||||
ImGui::DragFloat("io.FontGlobalScale", &ImGui::GetIO().FontGlobalScale, 0.05f, 0.5f, 5.0f);
|
||||
ImGui::BulletText("This is scaling font only. General scaling will come later.");
|
||||
ImGui::BulletText("Load an actual font that's not the default for best result!");
|
||||
ImGui::BulletText("See 'Widgets->Fonts' below for more..");
|
||||
ImGui::BulletText("Current font loader: '%s'", ImGui::GetIO().Fonts->FontLoaderName);
|
||||
ImGui::BulletText("Please submit feedback:"); ImGui::SameLine();
|
||||
ImGui::TextLinkOpenURL("https://github.com/ocornut/imgui/issues/8465");
|
||||
ImGui::Spacing();
|
||||
{
|
||||
ImGui::SeparatorText("dynamic_fonts branch");
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20);
|
||||
ImGui::ShowFontSelector("Font");
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20);
|
||||
if (ImGui::DragFloat("FontSizeBase", &style.FontSizeBase, 0.20f, 5.0f, 100.0f, "%.0f"))
|
||||
style._NextFrameFontSizeBase = style.FontSizeBase; // FIXME: Temporary hack until we finish remaining work.
|
||||
ImGui::SameLine(0.0f, 0.0f); Text(" (out %.2f)", ImGui::GetFontSize());
|
||||
ImGui::SameLine(); HelpMarker("- This is scaling font only. General scaling will come later.");
|
||||
//ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20);
|
||||
//ImGui::DragFloat("FontGlobalScale", &ImGui::GetIO().FontGlobalScale, 0.05f, 0.5f, 5.0f);
|
||||
ImGui::BulletText("Load a nice font for better results!");
|
||||
ImGui::BulletText("See 'Widgets->Fonts' below for more.");
|
||||
//ImGui::BulletText("Current font loader: '%s'", ImGui::GetIO().Fonts->FontLoaderName);
|
||||
ImGui::BulletText("Please submit feedback:"); ImGui::SameLine();
|
||||
ImGui::TextLinkOpenURL("#8465", "https://github.com/ocornut/imgui/issues/8465");
|
||||
ImGui::Spacing();
|
||||
}
|
||||
|
||||
IMGUI_DEMO_MARKER("Help");
|
||||
if (ImGui::CollapsingHeader("Help"))
|
||||
|
|
@ -8207,11 +8216,16 @@ void ImGui::ShowFontSelector(const char* label)
|
|||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
HelpMarker(
|
||||
"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
|
||||
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
||||
"- Read FAQ and docs/FONTS.md for more details.\n"
|
||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||
if (io.BackendFlags & ImGuiBackendFlags_RendererHasTextures)
|
||||
HelpMarker(
|
||||
"- Load additional fonts with io.Fonts->AddFontXXX() functions.\n"
|
||||
"- Read FAQ and docs/FONTS.md for more details.");
|
||||
else
|
||||
HelpMarker(
|
||||
"- Load additional fonts with io.Fonts->AddFontXXX() functions.\n"
|
||||
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
||||
"- Read FAQ and docs/FONTS.md for more details.\n"
|
||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||
}
|
||||
|
||||
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue