Imgui: Resolution dependent ?

Created on 4 Dec 2015  路  13Comments  路  Source: ocornut/imgui

Hi,

I run my application on several computers, but for the new one (has a big resolution) the icons and text looks very small. Is it normal ?

Take a look at the picture, I can easily read the icons/text from the other applications but not mine ?

screen

Most helpful comment

capture

All 13 comments

The default bitmap font size has a fixed line height of 13 pixels.
The easiest way would be to load and rasterize another font yourself and use a bigger size (and/or derive a size in pixels from resolution DPI).

Thanks Omar,

It will be fine to have this done automatically in ImGUI like in other GUI framework, no ?

The small bitmap one which is most convenient for debug interfaces and can be embedded in the source code is the default font and it can't be scaled up by nature (it's designed without anti-aliasing).

I can't tell of screen DPI in a portable manner. We'd have to incorporate the info in some ImGui data structure and have the application feed it. Once you've choosen a font we're talking about adding 1 line of code to load the font in your application so it's not exactly difficult to do it on application side.

(Mildly related - Fonts are rasterized into a texture bitmap on startup which also makes it tricky to have varied levels of zooming at runtime, we should also rewrite the system to use a more dynamic font atlas but that's quite a fair amount of work to get done and probably not a priority right now.)

If there is no "portable" solution... how does other libraries (QT by example) do ? :-P

capture

LOL ... of course !!

But QT is just an example... I suppose that it exists a solution :-P

Of course there is always the solution but I don't have the resources to implement everything. Quality patches are welcome.

The situation is also very different, hard to compare apples and oranges. ImGui is much more portable than QT by nature since it is platform agnostic, you can use ImGui odd setups, console systems, etc. The layer that connects ImGui to the os and graphics system is thin and modification to this layer have to be carefully considered. I don't think it would be the job of ImGui at the moment to decide on a font size in pixels because the sort of tools built with ImGui are often (but not always) for simplicity designed around hard-coded sizes.

Also see https://github.com/ocornut/imgui/pull/287 it looks like in your case you may have a retina type high-DPI setup and it's not being detected by the example app code?

And how can I setup the default font to another one ? I tried PushFont but it does not work !

"I tried PushFont but it does not work" doesn't constitute a repro so it's hard to answer you.
Check the example applications and the documentation in extra_fonts/.

BTW, yes I have a Retina screen !!

But I'm not sure to understand how your fix can increase the size ?

There's discussion in https://github.com/ocornut/imgui/pull/287 but it's unfinished. Just load and render a bigger font.

Solved this offline.
(Krys was adding font with the Merge flags so they were all merged into the same font, so first set of glyph was choosen for regular text)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BlackWatersInc picture BlackWatersInc  路  3Comments

the-lay picture the-lay  路  3Comments

SlNPacifist picture SlNPacifist  路  3Comments

spaderthomas picture spaderthomas  路  3Comments

mkanakis picture mkanakis  路  3Comments