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

Italic font gets a fallback in Cyrillic texts #8634

Closed
webknjaz opened this issue Sep 30, 2020 · 13 comments · Fixed by #13564
Closed

Italic font gets a fallback in Cyrillic texts #8634

webknjaz opened this issue Sep 30, 2020 · 13 comments · Fixed by #13564
Labels
bug 🐛 CSS/SCSS requires change to CSS/SCSS files good first issue This issue is ideal for first-time contributors! UX/UI design, user experience, user interface

Comments

@webknjaz
Copy link
Member

webknjaz commented Sep 30, 2020

Describe the bug

TL;DR normal and bold text gets rendered with "Source Sans Pro" but italics gets some locally-available Arial-based fallback. This makes the paragraph in the example below look inconsistent. I suppose "Source Sans Pro" does not contain any Cyrillic glyphs in italics.

pypi org--weird--italics

Expected behavior

The same font used for all text content consistently.

To Reproduce

  1. Switch PyPI to Ukrainian
  2. Go to https://pypi.org/help/#file-size-limit
  3. Look closer at the word in italics ("меншого")
  4. Check the font that got used for this word compared to the surrounding text. It is visible in DevTools if you highlight the corresponding <em> tag, then go to the "Computed" tab in the sidebar and scroll all the way down to the "Rendered Fonts" section.

My Platform

Google Chrome on Gentoo Linux (two of my laptops choose different fonts; because of the present fallbacks one system it is DejaVu Sans and the other it's Arial)
I've also tested it on a Chromebook (ChromeOS is technically Gentoo under the hood but it shouldn't matter) — it uses Arimo.
I'm pretty sure that this behavior will happen on any system that is able to download that main " Source Sans Pro" from the Internet so that it'll get used in some places but not the others.

Additional context

N/A

@hugovk
Copy link
Contributor

hugovk commented Sep 30, 2020

@pradyunsg
Copy link
Contributor

I guess it likely will, since the local system font would have the relevant glyphs -- although I'll let @webknjaz confirm if that's the case. :)

@webknjaz
Copy link
Member Author

Yeah, I think that using system font stack is a good idea regardless. Also, have you considered system-ui?

Also, I've tweaked CSS with

body {
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, Ubuntu, roboto, noto, segoe ui, arial, sans-serif;
}

and DevTools now shows "DejaVu Sans" in Rendered Fonts. It looks consistent with such setup:
pypi org--systemfontstack--demo

@webknjaz
Copy link
Member Author

Bonus thoughts: it's probably a good idea to have some e2e tests verifying if the glyphs that get selected for the render are taken from the same font. 🤔 Would something like Puppeteer expose this info?

@webknjaz
Copy link
Member Author

@pradyunsg FWIW this looks like a good candidate for "good first issue" and "Hacktoberfest" labels...

@di di changed the title [BUG] Italic font gets a fallback in Cyrillic texts Italic font gets a fallback in Cyrillic texts Sep 30, 2020
@di di added bug 🐛 CSS/SCSS requires change to CSS/SCSS files UX/UI design, user experience, user interface labels Sep 30, 2020
@nlhkabu nlhkabu added the good first issue This issue is ideal for first-time contributors! label Jan 2, 2021
@betatim
Copy link

betatim commented Jan 12, 2021

Hi 👋 !

I am looking for a good first issue to get a start in contributing to warehouse. For this issue is the thing to do: (1) fix the fact that italics are displayed using the wrong fallback font or (2) switch warehouse to using the "system font stack" everywhere?

@webknjaz
Copy link
Member Author

I think that the system font stack should be used.

@pradyunsg
Copy link
Contributor

pradyunsg commented Jan 12, 2021

I think using the system font stack is a good idea!

systemfontstack.com's font stack isn't perfect for Windows though (it selects Arial over Segoe UI despite the order because... browsers).

Here's a font stack that I've spent a lot of time tweaking and testing on Browserstack + asking around for folks to confirm things look right: https://github.com/pradyunsg/furo/blob/ecfee9c5a3872cfac72f5ee8c63c7d474ee8e60f/src/furo/assets/styles/variables/_index.scss#L39

@betatim
Copy link

betatim commented Jan 12, 2021

I opened a PR which seems to fix this. "Seems" because it feels like there should be more work required :D Looking forward to hear what you have to say.

@di
Copy link
Member

di commented Apr 1, 2022

From #8982, @divbzero says:

We could close this pull request and instead rely on the new version of Source Code Pro as @nlhkabu described on 23 Apr 2021.

The two third-party changes that @nlhkabu referenced are now resolved:

I confirmed today that https://pypi.org/help/#file-size-limit now displays italic ”меншого” using:

  • Chrome 100.0 on macOS 12.3
  • Firefox 98.0 on Ubuntu 20.04 LTS
  • Safari 15.4 on macOS 12.3

@webknjaz, can you confirm?

@webknjaz
Copy link
Member Author

webknjaz commented Apr 1, 2022

@di I haven't checked from the desktop but on mobile (OnePlus 9R/Android/Chrome) it still looks different:
Screenshot_2022-04-01-23-55-42-77_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

(screenshot taken a minute ago)

@divbzero
Copy link
Contributor

divbzero commented Apr 4, 2022

@webknjaz Just to clarify, does the italic on mobile (OnePlus 9R/Android/Chrome) look like a different font face, or just a different font size? To me, looks like the italic is rendered with the same Source Sans Pro font face but with a slightly bigger font size.

For comparison, this is what it looks like on desktop (macOS 12.3 / Safari 15.4):
macOS 12 3 Safari 15 4

@webknjaz
Copy link
Member Author

@webknjaz Just to clarify, does the italic on mobile (OnePlus 9R/Android/Chrome) look like a different font face, or just a different font size? To me, looks like the italic is rendered with the same Source Sans Pro font face but with a slightly bigger font size.

@divbzero I have checked on mobile (OnePlus 9R/Android/Chrome) and couldn't make up my mind if the font was the same, but it definitely looks like it has higher glyphs.
I've just checked in Firefox 102.0 on my Gentoo Linux laptop and saw that most of the paragraph does indeed use Source Sans Pro font face, but the word using italics falls back to Arial. I've gone googling, found a few sites with the font previews where I can type in test for testing and noticed that some style variants show Cyrillic letters correctly, but the Italic style doesn't have glyphs for it — so it always ends up using a fallback.

miketheman added a commit to miketheman/warehouse that referenced this issue May 2, 2023
The 3.x series of Source Sans was released in 2020, and contains the
desired italicized glyphs.
It was added to Google Fonts in 2021 in google/fonts#3856

The author dropped "Pro" from the name, and replaced with "3".

See: https://blog.adobe.com/en/publish/2020/11/30/whats-new-in-source-sans-3

Fixes pypi#8634

Signed-off-by: Mike Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 CSS/SCSS requires change to CSS/SCSS files good first issue This issue is ideal for first-time contributors! UX/UI design, user experience, user interface
Projects
None yet
7 participants