ContainedContext::setFontDensity() does:
ImGui::SetFontRasterizerDensity(roundf(m_scale * 100.0f) / 100.0f);
i.e. the density is the canvas zoom factor and nothing else. That is only correct on a
1x display.
Dear ImGui derives a window's rasterizer density in SetCurrentWindow():
g.FontRasterizerDensity = (viewport->FramebufferScale.x != 0.0f)
? viewport->FramebufferScale.x
: g.IO.DisplayFramebufferScale.x;
The contained context is created without a platform backend, so its viewport's FramebufferScale is 0 and its io.DisplayFramebufferScale is the default 1.0. ImGui can only ever derive 1.0 for it. setFontDensity() then overwrites even that with m_scale. So on a 2x display the host renders text at density 2.0 while every glyph inside the node editor is baked at density m_scale (1.0 at default zoom) and upscaled. Font size is still right, because new_style = orig_style carries FontScaleDpi across.
Repro: any HiDPI display (Retina Mac, 150–200% Windows scaling). Compare text in a node against ImGui text drawn outside the editor.
ContainedContext::setFontDensity()does:i.e. the density is the canvas zoom factor and nothing else. That is only correct on a
1x display.
Dear ImGui derives a window's rasterizer density in
SetCurrentWindow():The contained context is created without a platform backend, so its viewport's
FramebufferScaleis 0 and itsio.DisplayFramebufferScaleis the default 1.0. ImGui can only ever derive 1.0 for it.setFontDensity()then overwrites even that withm_scale. So on a 2x display the host renders text at density 2.0 while every glyph inside the node editor is baked at densitym_scale(1.0 at default zoom) and upscaled. Font size is still right, becausenew_style = orig_stylecarriesFontScaleDpiacross.Repro: any HiDPI display (Retina Mac, 150–200% Windows scaling). Compare text in a node against ImGui text drawn outside the editor.