gnustep / libs-back

The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
http://www.gnustep.org
GNU General Public License v3.0
50 stars 34 forks source link

Cairo: Disable font hinting when GSScaleFactor is not 1 to fix text d… #38

Closed anthonyc-r closed 2 years ago

anthonyc-r commented 2 years ago

…isplay issues

This commit disables font hinting in the cairo backend if GSScaleFactor is not 1. It fixes an issue I posted under libs-gui here: https://github.com/gnustep/libs-gui/issues/134.

anthonyc-r commented 2 years ago

Cheers, I've removed the excessive whitespace and log. I've also added a check if GSScaleFactor is unset and thus scale equals 0.

fredkiefer commented 2 years ago

I think the code is OK now. I am still unsure wether we need this change. When somebody manually changes the scaling factor she could as well switch off the font hinting by setting the other environment value to 33, which also is the default value. Maybe we should document this better?

anthonyc-r commented 2 years ago

Setting this to '17' appears to disable font hinting completely, perhaps a better patch would just set hinting to 17 if GSScaleFactor is set to anything other than 1, and GSFontHinting is not explicitly set. I see what you mean about being able to just explicitly set this, however I think that it shouldn't be possible to 'break' rendering by just setting scaling alone...

I don't know how difficult a change it would be, but perhaps respecting the advancements list (in GSShowGlyphsWithAdvances) would also allow for font hinting and scaling to be set together?

anthonyc-r commented 2 years ago

I've updated my commit to still allow for font hinting to be set via GSFontHinting.

fredkiefer commented 2 years ago

I really like the new code. Thank you for the patch.