Non Integer desktop scale issues


#1

On windows 10 if the desktop scale is non integer (say 1.75), the pixels gets sampled to different value(smoothed). What is the best way to fix this? What we want is to round the the bounds to the closest integer value, to make them crisp. Here is an example:

the grey rectangle is set at a thickness of 2. the top image is desktop scale of 1.75, while the bottom is destop scale 1.0 (images have been scaled in ms paint, so the pixels of this image dont reflect the pixels on the actual component in usage)

you can see the lower is more crisp than the upper. we would prefer it crisp rather than having it accurate to 2 * 1.75 (which is 3.5)


#2

When it comes to Windows’ non-integer scale value, I have overcome the whole issue by setting

JUCE_DISABLE_WIN32_DPI_AWARENESS

in my AppConfig.h.

Don’t know if this is relevant to your case because this implies that the resulting scale on Win will always be 1, but this could point you in the right direction


#3

This is not what we want, we still want to still take advantage of high density displays. We just dont want any smoothing to take place. I was thinking something like inside setBounds you adjust the bounds such that they are always integer values even after desktop scale multiplication happens.


#4

As long as JUCE uses DirectWrite to generate the glyphs, I’m pretty sure you have no control over that seeing that it’s a global OS setting.

OTOH, if you have the time/$£€‎¥, you could implement FreeType to generate glyphs .