johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.93k stars 273 forks source link

Disable subpixel smoothing when the reader is going to be inverted. #1137

Closed colons closed 9 months ago

colons commented 9 months ago

The 'Invert' theme inverting text after subpixel smoothing has already been applied was causing some pretty unpleasant-to-look-at chromatic aberration.

The gtk4 branch does not appear to have this theme. It seems like maybe it's intended to come back, based on the styles in reader.html, but I'm not going to try to fix this there since I can't test it.

Before: dark-prod

In this branch: dark-antialiased

johnfactotum commented 9 months ago

Thanks! Didn't know about this property. One question: does setting it to antialiased force antialiasing for users that disable it in fontconfig or gnome-tweaks? (Or does WebKitGTK not respect those to begin with?)

The gtk4 branch does not appear to have this theme.

It does, but it's now a setting called "Invert Colors in Dark Mode" that you can enable no matter which theme you're using.

The GTK 4 version also does inversion a bit differently in that only the book's contents are inverted. So the background (which is now the parent page behind the iframe that's displaying the book) is not inverted. See #269.

colons commented 9 months ago

One question: does setting it to antialiased force antialiasing for users that disable it in fontconfig or gnome-tweaks? (Or does WebKitGTK not respect those to begin with?)

I don't know, and I'm not entirely sure how I'd check. For what it's worth, nothing else I use has subpixel smoothing enabled; one of my monitors is sideways and another is a 4k monitor running at 1080p; it wouldn't make sense in my setup. But Foliate has it enabled in the reader view anyway.

It does, but it's now a setting called "Invert Colors in Dark Mode" that you can enable no matter which theme you're using.

Oh, okay, I didn't spot that. I'll try to make another MR doing this there.

colons commented 9 months ago

Ah, okay, I'm able to see this effect in some parts of books in the gtk4 branch, although I'm unable to make it go away by putting -webkit-font-smoothing: antialiased; in the reader styles in places I would have expected it to work. Is there a way to get to webkit's web inspector within foliate so I can see what's going on?

dark-warning-gtk4

This is less of a big deal for me in the gtk4 branch, though, for this book at least, since these warning boxes don't look as broken in the default dark view.

johnfactotum commented 9 months ago

You can open the inspector with F12 or from the view menu (the three dots menu on the headerbar above the page).

johnfactotum commented 9 months ago

Fixed in cfcfa6d2c00230f9e8a35483451cffb08ec7c1f6. Seems to working for me.