FreeCAD icons and splash screen look pixeled on High-DPI screens

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by uwestoehr »

I invested in a new laptop (15 inch, High-DPI screen). Now I can reproduce a negative feedback I got from people who give FreeCAD a first try:

- the application looks pixeled in some fields.

I can reproduce these two als with current master:
A: the splash screen font (we know the image looks pixeled because of its low resolution):
8dwlmd7NCm.png
8dwlmd7NCm.png (145.39 KiB) Viewed 1002 times
B: the icons in the preferences dialog:
FreeCAD_RYIqeAvMI0.png
FreeCAD_RYIqeAvMI0.png (32.72 KiB) Viewed 1002 times

For the latter, I see that in the AddonManager, the icons look nice, so there should be a way to solve at least issue B. @chennes , do you have an idea what setting is maybe just missing in the preferences dialog?
User avatar
Roy_043
Veteran
Posts: 8577
Joined: Thu Dec 27, 2018 12:28 pm

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by Roy_043 »

uwestoehr wrote: Thu Jan 19, 2023 2:25 pm we know the image looks pixeled because of its low resolution
There are in two images:
freecadsplash.png
freecadsplash2x.png

Something may be wrong with the 2nd image (assuming that is the image you see): it looks pixelated but does have a high resolution.
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by chennes »

The second image (2x) is actually just an upscale version of the low resolution original, we don’t have a true HiDPI version of that one available. The image’s author only created the low rez version, and was unable to directly make a high rez.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by chennes »

Regarding the icons: the addon manager just uses QIcons created from the original SVGs, and Qt deals with the HiDPI scaling. I never could figure out why the preferences and splash screen created the low rez assets. It is actually probably due to old attempts at HiDPI support conflicting with QT’s much-improved later code. Their early HiDPI support was pretty awful.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by uwestoehr »

There is also a third case of pixelation:

C: the NaviCube:
FreeCAD_GWDoGjsNdQ.png
FreeCAD_GWDoGjsNdQ.png (4.68 KiB) Viewed 911 times
I am working on this now. The problem hereby is that the font "Helvetica" is hard-coded, but on Win 11 there is no "Helvetica" anymore and thus an ugly replacement is used. So we need to add a preferences option to the dialog on what font to be usedfor the NaviCueb. I think I can do this by tomorrow.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by uwestoehr »

chennes wrote: Thu Jan 19, 2023 2:53 pm It is actually probably due to old attempts at HiDPI support conflicting with QT’s much-improved later code. Their early HiDPI support was pretty awful.
Thanks. Maybe, if you have time, you can have a look at the preferences dialog if you quickly see there a workaround that we should remove.
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by adrianinsaval »

uwestoehr wrote: Thu Jan 19, 2023 5:44 pm I am working on this now. The problem hereby is that the font "Helvetica" is hard-coded, but on Win 11 there is no "Helvetica" anymore and thus an ugly replacement is used. So we need to add a preferences option to the dialog on what font to be usedfor the NaviCueb. I think I can do this by tomorrow.
this was reported many times by @onekk, IIRC the Qt documentation claimed to safely fallback to other SansSerif fonts if Helvetica is not available. I could have sworn I made a PR to make the font just "SansSerif" and not specifically "Helvetica" but it seems I never did :oops:, not sure if this would solve it anyways.

edit: there is an existing issue for this: issue #5959
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by GeneFC »

uwestoehr wrote: Thu Jan 19, 2023 5:44 pm The problem hereby is that the font "Helvetica" is hard-coded, but on Win 11 there is no "Helvetica" anymore and thus an ugly replacement is used.
I agree that Helvetica is not included with Windows 11. However, there is a replacement in the registry to substitute Arial. (I have not changed anything related to that substitution on my computer.)

There may be something else going on other than the name of the font.

Gene
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by adrianinsaval »

Qt may have no knowledge of that registry key
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCAD icons and splash screen look pixeled on High-DPI screens

Post by uwestoehr »

adrianinsaval wrote: Thu Jan 19, 2023 7:22 pm Qt may have no knowledge of that registry key
I spent now some hours and it turned out the problem in Win 11 is the following:
- Qt uses "Helvetica" as alternative to get a Sansserif font ( styleHint QFont::SansSerif).
- The point is now that on Windows 11 sansserif fonts like DejaVu Sans do not have the
styleHint QFont::SansSerif but QFont::AnyStyle
- this is the reason why, at least on my PC, the first fomt in the list of installed fonts is used as replacement because no font hat the QFont::SansSerif styleHint anymore

The only solution I see is to allow the users in the preferences to use a font he likes in a size he likes. I implemented this but I am hanging at one point where I need help:
- in order to see the changes font and size directly in the NaveCube, I need to repaint its faces. To do so, I need to delete the existing NaviCube and then recreate it. Thus my question is:

Does anybody know how I can delete an existing NaviCube at runtime?
@Rexbas
Post Reply