LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Font rescaling on different screen resolutions

Hi,
I'm working on an application that is being used by many people on different
computers. Some users complain about controls and labels being unreadable
because of overlap between them. I did some tests during the last weeks, and
I can't solve the problem. I developped the UI on a system with 1024x768
resolution. The labels and controls only use NI fonts (NIDialog, NIEditor,
NIMenu and NIApp). I checked the UI on different computers, and even on
monitors with the same 1024x768 resolution, the layout of the panels was
messed up. The behaviour was worse on screens with other resolutions.

All panels have RESOLUTION_ADJUSTEMENT set at 100%, and
SCALE_CONTENTS_ON_RESIZE is enabled. I did tests with different fonts (also
host f
onts like Arial and Times New Roman), but there were always problems
with labels and controls being rescaled in an way they became unreadable or
they overlapped with each other.

I checked the NI fonts and I found out that some fonts show a rather odd
behaviour. For example: NIDialog point 9 looks exactly the same as NIDialog
12 point. The font NIEditor is even worse: NIEditor point 6 looks the same
as NIEditor point15! This means that when a panel containing NIDialog 12
point, is rescaled to 75% on a different screen resolution, the size of
controls is reduced properly, but the font looks exactly the same. In this
way, I can understand the problems when loading the application on a
different screen resolution, but I can't understand the differences between
the UI on computers with the same resolution! If this were not the case, I
could create different UI's for different resolutions (quite a work, because
I have more than 20 panels).

Does anyone have an idea where this behaviour come
s from and how to solve
it?

Thank you.

Stefaan Degrave
Ghent University, Belgium
0 Kudos
Message 1 of 2
(4,123 Views)
Stefaan,

There are two factors that can cause some of the behavior that you are seeing.

One factor is the different screen resolutions from machine to machine. This can cause your panels to appear smaller or larger relative to the screen, but it will not affect the sizes or positions of your controls *within* the panel. If the panel looks smaller, the reduced size will be proportional and it should not cause any overlapping.
Still, if you want to prevent this from happening, you can set the ATTR_RESOLUTION_ADJUSTMENT attribute to 100.

The other factor has to do with fonts. The pre-defined CVI fonts, such as "NI Dialog" and "NI Editor" are only aliases for specific system fonts, which can be different from machine to machine. If you create a control that uses one of these fonts, this control can change size if the panel is loaded in a machine where, for example, the user has chosen to use "large fonts" (through the Display Properties of the desktop). This can certainly cause controls to overlap each other.
The best way to prevent this is to not use these fonts, and instead use standard fonts, such as "Arial" or "Times New Roman." If you do this, the controls should have the same size in pixels regardless of what machine they're loaded in, and there should not be any overlapping.
You've identified another reason to not use "NI Dialog" which is that in most versions of Windows this will not even be a True-Type font, which is why different point sizes don't always translate into different actual sizes.

Based on your description of the problem, I would not use ATTR_RESOLUTION_ADJUSTMENT or ATTR_SCALE_CONTENTS_ON_RESIZE (this one is just for users to resize their panel contents at run-time), and instead I would make sure that all, or at least most of the controls, use standard named fonts.

One last hint: if you decide that you want to change the fonts of a large number of controls, the fastest way to do that in the UI Editor is to first set the fonts you want to use in the Options>>Preferences dialog, and then select the controls you want to change and click on Edit>>Apply Default Font.

Luis
NI
Message 2 of 2
(4,123 Views)