PixInsight Forum (historical)

Software Development => PCL and PJSR Development => Topic started by: mschuster on 2013 April 03 19:21:42

Title: PJSR ComboBox clipping
Post by: mschuster on 2013 April 03 19:21:42
In 1.8RC5, Win 7, I sometimes see small clipping on the left side of ComboBox values. See the attached pic.
Mike
Title: Re: PJSR ComboBox clipping
Post by: mschuster on 2013 April 17 16:48:20
H Juan,
I still see clippng in RC6 Win7. (Note the clipped "8" in the image above.)
Mike
Title: Re: PJSR ComboBox clipping
Post by: Juan Conejero on 2013 April 17 16:51:01
This is weird. I cannot reproduce it on Windows 7 and 8. Have you customized font settings? Can you send me the source code for that dialog, so I can try to reproduce the problem?
Title: Re: PJSR ComboBox clipping
Post by: mschuster on 2013 April 17 16:57:25
Here it is:

https://dl.dropboxusercontent.com/u/109232477/ContrastToBackgroundNoiseRatio.0.2.js (https://dl.dropboxusercontent.com/u/109232477/ContrastToBackgroundNoiseRatio.0.2.js)
Title: Re: PJSR ComboBox clipping
Post by: Juan Conejero on 2013 April 17 17:05:31
I don't see anything problematic. As a workaround, you can add white spaces at the beginning and end of each combo box item:

Code: [Select]
   this.backgroundPercentileLabels = new Array(
      " 1st ",
      " 2nd ",
      " 5th ",
      " 10th ",
      " 20th ",
      " 50th ",
      " 100th "
   );
   this.backgroundCycleSpinsLabels = new Array(
      " 1 ",
      " 2 ",
      " 4 ",
      " 8 "
   );

An ugly solution but should work. Tomorrow I'll check this script on our Windows machines to see if I can find the cause of this problem. Sorry for the inconvenience.
Title: Re: PJSR ComboBox clipping
Post by: mschuster on 2013 April 17 17:07:01
OK thank you!
Title: Re: PJSR ComboBox clipping
Post by: Andres.Pozo on 2013 April 18 02:24:13
This happens also with my scripts. I use Win7 x64 with default font sizes (dpi=96).
Title: Re: PJSR ComboBox clipping
Post by: Juan Conejero on 2013 April 22 11:35:22
I have reproduced and investigated this problem on Windows. The problem is the Segoe UI font, which the default PixInsight style sheet uses on all supported versions of Windows. Unfortunately, the numerals in this font are rendered with a strange left displacement, something like a negative kerning, which causes this two-pixel clipping. This might be a Qt font rendering problem. There's no way to fix this with CSS code, since it has nothing to do with margin properties, and the clipping occurs 'behind' the left padding, so changing the padding only moves the text but doesn't fix the clipping.

I am considering using a different font for the Windows versions of PixInsight. A good candidate would be Verdana. Another possibility, probably more robust, would be including a custom font in the PixInsight distribution, just as we have now Deja Vu Sans on all platforms. Unfortunately, Deja Vu has some rendering problems on Windows that make it a poor choice for the whole GUI.

In the meanwhile, I think that adding a space at the beginning of each combo box item is the best solution. Note that this is only necessary if the combo box items start with a decimal digit character.