mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: fallback to default default rasterizer density + pick one from existing viewports at the time of calling AddUpdateViewport().
# Conflicts: # imgui.cpp
This commit is contained in:
parent
83aad81279
commit
b2343d6247
2 changed files with 6 additions and 1 deletions
|
|
@ -4399,7 +4399,10 @@ static void SetCurrentWindow(ImGuiWindow* window)
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures)
|
if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures)
|
||||||
g.FontRasterizerDensity = window->Viewport->FramebufferScale.x; // == SetFontRasterizerDensity()
|
{
|
||||||
|
ImGuiViewport* viewport = window->Viewport;
|
||||||
|
g.FontRasterizerDensity = (viewport->FramebufferScale.x != 0.0f) ? viewport->FramebufferScale.x : g.IO.DisplayFramebufferScale.x; // == SetFontRasterizerDensity()
|
||||||
|
}
|
||||||
ImGui::UpdateCurrentFontSize();
|
ImGui::UpdateCurrentFontSize();
|
||||||
ImGui::NavUpdateCurrentWindowIsScrollPushableX();
|
ImGui::NavUpdateCurrentWindowIsScrollPushableX();
|
||||||
}
|
}
|
||||||
|
|
@ -15249,6 +15252,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
||||||
main_viewport->Pos = ImVec2(0.0f, 0.0f);
|
main_viewport->Pos = ImVec2(0.0f, 0.0f);
|
||||||
main_viewport->Size = g.IO.DisplaySize;
|
main_viewport->Size = g.IO.DisplaySize;
|
||||||
main_viewport->FramebufferScale = g.IO.DisplayFramebufferScale;
|
main_viewport->FramebufferScale = g.IO.DisplayFramebufferScale;
|
||||||
|
IM_ASSERT(main_viewport->FramebufferScale.x > 0.0f && main_viewport->FramebufferScale.y > 0.0f);
|
||||||
|
|
||||||
for (ImGuiViewportP* viewport : g.Viewports)
|
for (ImGuiViewportP* viewport : g.Viewports)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5225,6 +5225,7 @@ ImFontBaked* ImFontAtlasBakedGetOrAdd(ImFontAtlas* atlas, ImFont* font, float fo
|
||||||
{
|
{
|
||||||
// FIXME-NEWATLAS: Design for picking a nearest size based on some criteria?
|
// FIXME-NEWATLAS: Design for picking a nearest size based on some criteria?
|
||||||
// FIXME-NEWATLAS: Altering font density won't work right away.
|
// FIXME-NEWATLAS: Altering font density won't work right away.
|
||||||
|
IM_ASSERT(font_size > 0.0f && font_rasterizer_density > 0.0f);
|
||||||
ImGuiID baked_id = ImFontAtlasBakedGetId(font->FontId, font_size, font_rasterizer_density);
|
ImGuiID baked_id = ImFontAtlasBakedGetId(font->FontId, font_size, font_rasterizer_density);
|
||||||
ImFontAtlasBuilder* builder = atlas->Builder;
|
ImFontAtlasBuilder* builder = atlas->Builder;
|
||||||
ImFontBaked** p_baked_in_map = (ImFontBaked**)builder->BakedMap.GetVoidPtrRef(baked_id);
|
ImFontBaked** p_baked_in_map = (ImFontBaked**)builder->BakedMap.GetVoidPtrRef(baked_id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue