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

Bold text not rendering for some fonts at font-weight: 600 e.g. 'Segoe UI' #24305

Closed
belzecue opened this issue Apr 24, 2023 · 22 comments · Fixed by #24307
Closed

Bold text not rendering for some fonts at font-weight: 600 e.g. 'Segoe UI' #24305

belzecue opened this issue Apr 24, 2023 · 22 comments · Fixed by #24307
Labels

Comments

@belzecue
Copy link

belzecue commented Apr 24, 2023

Description

I noticed this in my hosted 1.18.5 instance: bold wiki text was not showing as bold in latest Chrome browser. I went straight to try.gitea.io and reproduced the issue there on the current dev instance. Curiously, this issue does not present with Firefox, which renders the bold as expected, so it seems Chrome is rendering the same CSS differently [EDIT: more likely different fonts, as the Chrome instance was on Linux and the Firefox test was on a windows 10 box].

Video showing my experience:

desktop-2023-04-24_22.36.53.mp4

There seems to be two CSS definitions for STRONG that are related to this issue. When I disable one of them, as shown in the video, bold returns.

Gitea Version

try.gitea.io

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

1.20.0+dev-559-g75c62054a

Operating System

Linux (Debian)

How are you running Gitea?

try.gitea.io

Database

None

@belzecue belzecue changed the title BOLD not working for Chrome - competing STRONG CSS definitions BOLD wiki text not working for Chrome - competing STRONG CSS definitions Apr 24, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 24, 2023

font-weight: 600 works for me in my Chrome on macOS.

I guess it's related to your desktop environment or your font library?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 24, 2023

Actually, this (below) font is also "font-weight: 600". Could you try to manually set the font-weight to other values to try? eg: 900, bold, etc.

Screenshot:

image

image

@belzecue
Copy link
Author

Doublechecking my Chrome bold display by testing at w3schools.com:

image

Can't repro missing bold on any other app or site, so far.

@wxiaoguang
Copy link
Contributor

I guess it's related to font-weight value.

I can see that: font-weight: bolder works for you, but 600 not.

So could you help to confirm whether other values work? 900, bold (not bolder).

@belzecue
Copy link
Author

Yes, setting it to 900 restores the bolding...

desktop-2023-04-24_23.04.01.mp4

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 24, 2023

Well, then it's still related to your font library

Your font doesn't render font-weight: 600 as bold , which is lighter than 900 / "bolder" 😭

What's the minimal value it could render as bold?

(ps: do you know your font's name?)

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 24, 2023

MDN has a page for bolding testing (the values in "Try it" could be changed)

https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight

@belzecue
Copy link
Author

What's the minimal value it could render as bold?

601 !! LOL. Crazy. That does not seem right.

ps: do you know your font's name?

"Segoe UI" according to the CSS "computed" value in Chrome's inspector.

@wxiaoguang
Copy link
Contributor

Well, maybe 601 is not wrong .... according to MDN

The "bold" starts from 700 ....

image

@wxiaoguang
Copy link
Contributor

Maybe we need this PR: Use font-weight: bold instead of 600 #24307

@belzecue
Copy link
Author

belzecue commented Apr 24, 2023

OK, looks to be just this font. For some reason it bucks the standards and only renders bold at 601 and higher.

I tested at https://developer.mozilla.org/en-US/docs/Web/CSS/font-family by modifying the last font to be 'segoe-ui' to display my font in the list, then I added 'font-weight:600' to all the displayed fonts, and only 'segoe-ui' failed to render in bold.

desktop-2023-04-24_23.19.02.mp4

@belzecue
Copy link
Author

Maybe we need this PR: Use font-weight: bold instead of 600

Using font-weight:bold does seem safer and less prone to this kind of font edge case, and decouples from the actual underlying font weight. Good example here: https://www.quirksmode.org/css/text/fontweight.html

@silverwind
Copy link
Member

700 seems to excessivly bold to me when semi-bold can be rendered. Show a screenshot of this please:

https://codepen.io/silverwind/pen/jOeBmvj

Here is MacOS:

Screenshot 2023-04-24 at 17 27 50

@belzecue belzecue changed the title BOLD wiki text not working for Chrome - competing STRONG CSS definitions BOLD wiki text not working for some fonts at font-weight: 600 e.g. 'Segoe UI' Apr 24, 2023
@belzecue belzecue changed the title BOLD wiki text not working for some fonts at font-weight: 600 e.g. 'Segoe UI' Bold text not rendering for some fonts at font-weight: 600 e.g. 'Segoe UI' Apr 24, 2023
@belzecue
Copy link
Author

belzecue commented Apr 24, 2023

In Segoe UI, doesn't kick in until 700 (in this test; 601 otherwise).

image

@silverwind
Copy link
Member

Hmm, seems your OS doesn't offer much in terms of bold variation. Such problems are usually Linux-exclusive.

@wxiaoguang
Copy link
Contributor

Then font-weight: 610 seems a reasonable value for most users.

@silverwind
Copy link
Member

@belzecue show screenshot of this one please: https://codepen.io/silverwind/pen/jOeBmvj

@belzecue
Copy link
Author

belzecue commented Apr 24, 2023

Working. Although, as you observed, on this device it renders a uniform weight from 601 all the way up. No graduation. Perhaps to do with the display/desktop manager on my Linux installation.

image

@silverwind
Copy link
Member

Yeah I guess your bold kicks in at > 600, we will use 610.

@silverwind
Copy link
Member

Actually we'll go with 601, as you had already indicated that this works for you above.

@belzecue
Copy link
Author

belzecue commented Apr 24, 2023

Chrome/Chromium has had problems with Segoe-UI before: https://bugs.chromium.org/p/chromium/issues/detail?id=791305&q=component%3ABlink%3EFonts%20bold&can=2

@silverwind
Copy link
Member

silverwind commented Apr 24, 2023

I think what you are lacking is a font that supports more fine-grained boldening, likely called variable font. If there's a good one available, it could be considered for our font stack.

silverwind added a commit that referenced this issue Apr 24, 2023
Fix #24305

According to MDN, "bold" starts from 700, some fonts do not provide
"bolding" for weight 600

https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
wxiaoguang added a commit to wxiaoguang/gitea that referenced this issue Apr 25, 2023
Fix go-gitea#24305

According to MDN, "bold" starts from 700, some fonts do not provide
"bolding" for weight 600

https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
# Conflicts:
#	web_src/js/components/DashboardRepoList.vue
silverwind pushed a commit that referenced this issue Apr 25, 2023
Backport #24307

Fix #24305

According to MDN, "bold" starts from 700, some fonts do not provide
"bolding" for weight 600

Manually backport, no CSS conflict.
silverwind added a commit that referenced this issue May 21, 2023
…, introduce new font weight variables (#24827)

There was some recent discussion about this in Discord `ui-design`
channel and the conclusion was that
#24305 should have fixed their
OS font installation to have semibold weights.

I have now tested this 601 weight on a Windows 10 machine on Firefox
myself, and I immediately noticed that bold was excessivly bold and
rendering as 700 because browsers are biased towards bolder fonts. So
revert this back to the previous value.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants