Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text rendering: weight and consistency across OSes #1675

Closed
DavidOliver opened this issue Mar 6, 2023 · 5 comments · Fixed by #1677
Closed

Text rendering: weight and consistency across OSes #1675

DavidOliver opened this issue Mar 6, 2023 · 5 comments · Fixed by #1677

Comments

@DavidOliver
Copy link
Contributor

DavidOliver commented Mar 6, 2023

@josevalim, further to #1668, I've tested in Safari in Mac OS (Safari 16, Mac OS Ventura), and using the following CSS does seem to make all text thinner, contrary to what you found the other day:

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

(I find that I often need to empty the _build directory for newly-built assets to be included in newly-generated docs; perhaps this prevented you from seeing the change?)

This results in type rendering being very closely matched in Mac OS and Linux. Left Safari/Mac OS with new props, right Linux (with new props, but unaffected and so as before):

image

Now that I have both rendering the same/similarly, I should be able to adjust the weights of text in the sidebar (light to regular), and some other places as appropriate, to bring both into line with the current rendering in Mac OS.

One thing to note before I proceed, however, is that the serif font used for the main text (Merriweather, 400/normal) does not have a 500 weight that we can move up to - only 700/bold, which is not an option as that does not render well in either Mac OS or Linux. So the main text would look slightly thinner than you've been used to in Mac OS:

image

Is this acceptable to you? I imagine it may initially feel a little thin to you, but I believe this rendering to be a little clearer and nearer a normal, not semi-bold, weight.

Although applying the above approach across the board is my preference to maximise simplicity and consistency, if you don't like the lighter serif font for the main text, we could limit the new properties to the sidebar and allow the main text to be different (but readable) across OSes.

@josevalim
Copy link
Member

Awesome find! Indeed, I was testing it the wrong way. Would it be possible to apply these changes only to the sidebar? This way we don’t have to concern about other fonts.

@DavidOliver
Copy link
Contributor Author

DavidOliver commented Mar 6, 2023

Ah, thanks for confirming.

Yes, as mentioned, we can limit the application of the alternative anti-aliasing method to the sidebar. This comes with the disadvantage of the main content continuing to be inconsistent across OSes, and so I recommend we only take this approach if you don't like the lighter rendering of Merriweather for the main text.

I appreciate we're most concerned with Lato at small sizes in light on dark, which is mostly/all(?) the sidebar, but, nonetheless, it seems like a good opportunity to get everything as consistent as possible. But if you confirm the light rendering of Merriweather in Mac OS as in the last screenshot above is not desired, I'll proceed and limit to the sidebar.

@josevalim
Copy link
Member

Can you please send a PR? I am unable to make these configurations have an effect and I think I am missing something up.

I am also happy to change the font if we think it is too thin and there isn't an increased weight. :)

@DavidOliver
Copy link
Contributor Author

DavidOliver commented Mar 6, 2023

Is that a PR to apply the alternative anti-aliasing to everything, so that you can test the effect? I'm happy to do that, perhaps in a couple of stages so that you can test the main effect before I tweak details here and there or scale back to just the sidebar if necessary.

Edit: now I read your last sentence again I think that is what you meant - sorry. But if you could confirm/clarify so that we're definitely on the same page, that would be great.

Hopefully we can keep the same fonts and character as at present. :)

@josevalim
Copy link
Member

A basic PR you used to validate and generate the screenshots is perfect.

DavidOliver added a commit to DavidOliver/ex_doc that referenced this issue Mar 9, 2023
Fixes elixir-lang#1675

As the sidebar type is thinned in Mac OS via the alternative anti-aliasing, its weight can be increased from light to normal to avoid overly thin type in Linux and Windows.

The thin weight is preserved/used in places where differentiation from normal/bold is warranted.

Additionally, the normal/400 weight font was not being loaded, which resulted in type set to normal being rendered light. We're now loading light/300, normal/400 and bold/700 for the Lato sans serif font.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants