Safari 14.1 does not follow setting
danilokleber opened this issue ยท 13 comments
Hey there. First of all, thanks for this utility!
I noticed that Safari 14.1 started to render fonts with smoothing on some websites. The rest of the system is fine as far as right now, including Safari's interface. Another place I noticed font smoothing was in email rendering on Spark. Do you know if this has to do with some new thing regarding to HTML rendering itself?
Feel free to close this issue if that's not applicable to the project. Thanks!
Hi @danilokleber, thank you for your comment! I'm glad you found the app useful, and thank you for flagging up the issue with Safari 14.1.
I'll be upgrading to Big Sur 11.3 in the next few days, so I'll be able to test the issue you noticed with Safari 14.1 at that point. Do you have any websites in particular where you noticed the font smoothing preferences not being respected?
Thanks for the reply @abyrne10!
I can say that GitHub and Google results are showing this behavior. Here's a comparison with Brave for Google results if that helps. Safari is in the back with a bolder font.
Thanks @danilokleber, that's helpful, I'll let you know what I find ๐
I did some more research and found one way around it if someone wants to minimize this issue.
It appears to fix it only in Safari itself but already helps a lot. HTML rendering still looks off in other apps. So I guess those new macOS/Safari versions changed something under the hood.
I just upgraded to macOS 11.3 with Safari 14.1 and I can confirm the issue. As mentioned, it applies not only to the browser, but other contexts in which HTML is rendered, for example, rich-text emails in Mail.app.
I was hoping macOS 11.3.1 would fix this, but no.
Same thing on macOS 11.4 unfortunately.
Hi @danilokleber and @leafac, sorry for taking so long to address this. We've now been able to spend some proper time on this, and we've tracked it down to a bug that was introduced into WebKit whereby it wasn't respecting the AppleFontSmoothing
default setting, which is why the problem appears in Safari, Mail, Spark and other apps that use views backed by WebKit.
We can confirm that this issue has been fixed in recent builds of WebKit for Big Sur. However, at the the time of writing this, builds including the font smoothing fix had not yet made their way to the Safari Technology Preview, so it will probably be some time before Apple ships an update that fixes the font smoothing issue.
We created a small reference app comparing native text views with WebKit views to help with testing and debugging this issue, available here. The below screenshot shows what it looks like.
Here's how you can use it to test WebKit for yourself:
- Download a WebKit build, or get the code, checkout the commit you want to test, and build it from source. This took around an hour each time on a MacBook Pro (15-inch, 2017). To build older snapshots, we had to use a older versions of the Xcode command line tools to avoid compiler errors.
- Clone and open the Font Smoothing WebKit Bug project in Xcode, create a scheme if one doesn't exist, build and run the app, and confirm that font smoothing is respected in the text view but not the web view.
- Add an environment variable to the run configuration with the name
DYLD_FRAMEWORK_PATH
and the path to the folder containing your archived or built WebKit framework as the value. This will tell dyld, the dynamic linker, to link the app to that version of WebKit instead of the version shipped with macOS. - Disable System Integrity Protection by restarting your Mac in recovery mode, launching a terminal, and running
csrutil disable
. N.B. make sure to re-enable SIP by runningcsrutil enable
in recovery mode once you've finished testing. Disabling SIP is required because dyld will ignore theDYLD_FRAMEWORK_PATH
environment variable if SIP is enabled. - Build and run the project again in Xcode, and verify that font smoothing is now being respected by the web view (assuming you are using a build of WebKit where the bug either doesn't exist or has been patched out).
We think this was the patch that introduced the bug to WebKit (note also that it was reviewed after it was merged), and that this patch may have been the one that fixed the font smoothing issue, but we haven't confirmed it because the WebKit built archives don't go back very far, and building each snapshot from source takes a long time.
Unfortunately we weren't able to get Safari to work with the patched versions of WebKit using the scripts that WebKit includes, as the API seems to have changed.
I will update you again if we find a temporary workaround for this issue before Apple ships a fix. Cheers!
Wow, @abyrne10. That was a great roundup! Thank you very much for the time invested in this issue. Let's hope the fix lands on Apple's side soon.
The Safari Technology Preview 127 contains the fix. Obviously is does not apply this to the system WebKit (for apps like Mail). Hopefully the release version of Safari 15 will have this.
The Safari Technology Preview 127 contains the fix. Obviously is does not apply this to the system WebKit (for apps like Mail). Hopefully the release version of Safari 15 will have this.
Great news ๐
Here is my temporary fix, by using a custom CSS file through Safari's preferences (-> Advanced -> Style sheet):
html body * {
-webkit-font-smoothing: antialiased !important;
}
This seems to be fixed in Safari 14.1.2 (that came with macOS 11.5)!