Debugging font antialiasing

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!
Post Reply
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Debugging font antialiasing

Post by chennes »

I'm returning (once again) to the splashscreen, and trying to get the text on it to look good. I've started by embedding the "official" font into the executable. Then, I've rendered the text three ways...

With antialiasing (top is Photoshop, bottom is Qt):
WithAntiAliasing.png
WithAntiAliasing.png (17.72 KiB) Viewed 913 times
Without antialiasing, but still HiDPI:
AntialiasingOff.png
AntialiasingOff.png (16.72 KiB) Viewed 913 times
Without antialiasing, lowDPI:
LowDPI.png
LowDPI.png (14.25 KiB) Viewed 913 times
Basically, the Qt font rendering looks awful. Straight lines aren't straight, smooth curves aren't smooth, there's a weird blue cast to the edges, etc. I've played with toggling basically every setting I can thing of in QPainter and QFont, and I can't get anything approaching Photoshop levels of smoothness. On a High-DPI display it looks pretty terrible. Does anyone have any ideas about what might be causing these issues?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Debugging font antialiasing

Post by GeneFC »

Do you need to use a real-time font at all?

One approach would be to use the font at very large scale to get the desired smoothness and then shrink an image to the size needed for the splashscreen. Just paste the "FreeCAD" into the rest of the image instead of including a font overlay.

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

Re: Debugging font antialiasing

Post by adrianinsaval »

Agreed, if it's about allowing branding, well forks can just change the splashcreen image
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Debugging font antialiasing

Post by chennes »

I'm using the "FreeCAD" text as a test subject here, but we do also need the version string, and I think we shouldn't bake that into the graphic.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Debugging font antialiasing

Post by onekk »

It seems that the problem is known, there are some mitigation here:

https://stackoverflow.com/questions/310 ... g-qpainter


But I don't know if this is similar to your problem, it seem related to dpi and QPainter it is 4 years old but...

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
mfro
Posts: 664
Joined: Sat Sep 23, 2017 8:15 am

Re: Debugging font antialiasing

Post by mfro »

Do you have subpixel rendering + scaling active on your screen? The subpixel rendering won't survive scaling and makes things only worse.
Cheers,
Markus
Post Reply