ControlSystemStudio / cs-studio

Control System Studio is an Eclipse-based collections of tools to monitor and operate large scale control systems, such as the ones in the accelerator community.
https://controlsystemstudio.org/
Eclipse Public License 1.0
112 stars 96 forks source link

BOY: Font and widget sizes scale inconsistently #107

Open mdavidsaver opened 11 years ago

mdavidsaver commented 11 years ago

At present the apparent size of widget text and widget bounding boxes do not scale together. In an environment with computers having different screen sizes and pixel densities (DPI) gives inconsistent visuals. Text which fits on one computer will be clipped on others.

In some cases this can be "tweaked" by DPI value used in rendering fonts. However, we have only found system wide controls, which causes some other applications to look strange.

In the following examples the same .opi is rendered at 75 DPI.

![Uploading boyfonts.png . . .]()

and 96 DPI

![Uploading boyfonts2.jpg . . .]()

Some discussion may also be found here:

http://wiki.mandriva.com/en/Font_Size_and_DPI

We would like to request that BOY should ensure that the relative sizes of text and widgets be constant on all systems.

xihui commented 11 years ago

I will check if it is possible to set font size according to widget's size. BTW, could you send the screenshots again?

mdavidsaver commented 11 years ago

It seems that attaching images doesn't work well for me...

https://pubweb.bnl.gov/~mdavidsaver/files/boyfonts.png

https://pubweb.bnl.gov/~mdavidsaver/files/boyfonts2.jpg

shroffk commented 11 years ago

One of the possible solutions could be to try to move towards some form of definition of fonts in pixels. I tried the following snippet which defines the font size in number of pixels and then tries to calculate the point size associated with it.

final FontData[] fd = text1.getFont().getFontData(); final GC gc = new GC(text1); final FontMetrics fm = gc.getFontMetrics();

int pixelHeight = 25; int pointHeight = pixelHeight * 72 / Display.getDefault().getDPI().y; FontData fontData = new FontData(fd[0].getName(), pointHeight, fd[0].getStyle()); System.out.println(fontData); text1.setFont(new Font(d, fontData));

xihui commented 11 years ago

I have added code to automatically scale font size to make text size fit the size of text widgets (Label, Text Update and Text Input). Note that this function doesn't work for "wrap words" Label and native Text Input. Let me know if it works for you. If it doesn't work, please reopen this issue.

mdavidsaver commented 11 years ago

Xihui, this is a critical issue for us. Please leave this issue open pending testing and verification of the fix.

berryma4 commented 10 years ago

Michael, do you feel this is fixed?

berryma4 commented 10 years ago

moving to 3.2.12

berryma4 commented 10 years ago

What is the status on this? has the fix been verified with Micheal?

berryma4 commented 10 years ago

@shroffk can you comment on if this is fixed?