ralfbiedert / cheats.rs

Rust Language Cheat Sheet - https://cheats.rs
https://cheats.rs
4.09k stars 382 forks source link

Blurred font in Safari #180

Closed lucioreyli closed 1 year ago

lucioreyli commented 1 year ago

I'm the only nerd at the internet using Safari, but the cheatsheet site is blurred for me. I'm using the Safari - Version 16.3 (18614.4.6.1.5) as MacOS Ventura - Version 13.2 but I was tried using Safari - Version 15.6 (15613.3.9.1.7, 15613) running in macOS Catalina - Version 10.15.7. But this problem is fixed running in another browser (I tried Mozilla Firefox and Chromium), but only Safari keeps blurred. Can someone give-me more pixels?

Safari example#1 Screenshot 2023-02-07 at 14 37 26

Safari example#2 Screenshot 2023-02-07 at 14 36 59

Chromium example#1 (of 1) Screenshot 2023-02-07 at 14 48 53

I don't know how fix this because it's Zola project and I'm React developer (⚛️) so I cannot do pull request (💀) but it's problably a Safari problem to caching font to optimize font loading (maybe).

ralfbiedert commented 1 year ago

For me even your window decoration is blurred in these screenshots :)

Since every other browser seems to work fine I think this is a Safari issue, but could you try

image

lucioreyli commented 1 year ago

If I open "Inspect Element" works fine (because reduce the app width): Screenshot 2023-02-07 at 15 52 36

And removing transform-scale works fine too: Screenshot 2023-02-07 at 15 52 44

ralfbiedert commented 1 year ago

Not sure what to do, this seems to be a Safari font rendering bug w.r.t. scale. For now my recommendation would be not to hold it like that to resize the window. I'm a bit reluctant adding a workaround, as they tend to be brittle and I don't have a Safari device to test anymore.

Any other ideas?

lucioreyli commented 1 year ago

The zoom css property looks good to solve this problem in Safari, replacing the transform/scale property image

I tested in Safari and Chromium but I don't know the behavior in Mozilla Firefox 🔥 Screenshot 2023-02-07 at 17 31 12

ralfbiedert commented 1 year ago

Apparently this doesn't work in Firefox :(

https://caniuse.com/css-zoom

lucioreyli commented 1 year ago

Can we use this?

.book-content {
    -moz-transform: scale(1.05); /* property for Firefox */
    zoom: 105%; /* property others browsers */
}

because using this:

.book-content {
    transform: scale(1.05);
    zoom: 105%; 
}

can duplicate the scale in the app.

lucioreyli commented 1 year ago

I don't have this issue using Safari in iOS image

ralfbiedert commented 1 year ago

Let's try this. Might have to revert if it breaks rendering in other browsers.

ralfbiedert commented 1 year ago

Ah, just noticed I have some trouble deploying as I'm on vacation. ETA might be a few days.