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

SF Mono/SFMono-Regular displays Menlo font, use ui-monospace instead #22125

Closed
saegl5 opened this issue Dec 14, 2022 · 9 comments · Fixed by #24442
Closed

SF Mono/SFMono-Regular displays Menlo font, use ui-monospace instead #22125

saegl5 opened this issue Dec 14, 2022 · 9 comments · Fixed by #24442
Labels
topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality

Comments

@saegl5
Copy link
Contributor

saegl5 commented Dec 14, 2022

Description

Change in index.css:
--fonts-monospace: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);

To:
--fonts-monospace: ui-monospace, "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);

At least for me, Gitea/Safari cannot find SF Mono or SFMono-Regular, unless I replace either one with ui-monospace.

See visual examples (below).
Also, I reproduced the bug in https://try.gitea.io/huihuiyule/spring-cloud-alibaba under "Add maven dependency."

(For now, I do customize the default theme with :root { --fonts-monospace: ui-monospace, "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace, var(--fonts-emoji) !important; }.)

Screenshots

Visual examples: (edited!)

'SF Mono' or "SFMono-Regular"
(Default)
ui-monospace
(Changed)
Screenshot 2023-04-29 at 9 49 41 PM Screenshot 2023-04-29 at 9 50 21 PM
monospaced text is NOT displaying SF Mono monospaced text is displaying SF Mono

Gitea Version

1.17.3

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

macOS Ventura 13.0.1

Browser Version

Safari Version 16.1

@saegl5 saegl5 added type/bug topic/ui Change the appearance of the Gitea UI labels Dec 14, 2022
@silverwind
Copy link
Member

silverwind commented Dec 14, 2022

This looks like a change we could try. I don't understand the details but https://qwtel.com/posts/software/the-monospaced-system-ui-css-font-stack/ mentions ui-monospace is the only way to get the "SF Mono" typeface to show in a browser. I suspect what you are seeing is actually Menlo.

@saegl5
Copy link
Contributor Author

saegl5 commented Dec 16, 2022

@silverwind thank you for following up

correct (re: "ui-monospace is the only way..." and "Menlo")
also, I couldn't put it more succinctly than you did (thank you too)

@gnat
Copy link
Contributor

gnat commented Dec 18, 2022

Enabling this for mac users would be cool- I actually install SFMono on my Ubuntu machines too.

@silverwind silverwind added type/enhancement An improvement of existing functionality and removed type/bug labels Dec 21, 2022
@saegl5
Copy link
Contributor Author

saegl5 commented Apr 30, 2023

edited visual examples to help make the issue clearer :)
in the original visual examples, knowing where to focus one's attention was tricky
if one still may not see any differences between Menlo and SF-Mono, compare letters like r and l ("l" as in lima)

(issue is still present in Gitea 1.91.0+)

@silverwind
Copy link
Member

According to https://caniuse.com/extended-system-fonts, ui-monospace is only supported by the Safari browser, so I think we ought to keep SFMono-Regular around to support other browsers as well.

Try #24442 which does just that.

@silverwind
Copy link
Member

Actually I've removed SFMono-Regular as well. It seems to have been there to support Safari before 13.4, and I think even with it removed, Menlo or Monaco will give an acceptable rendering.

@wxiaoguang
Copy link
Contributor

But there are other OS and browsers ... not sure whether we haven enough confidence to remove some mono fonts.

@silverwind
Copy link
Member

silverwind commented Apr 30, 2023

Yeah it's a complicated topic. For now I've changed #24442 back to additions only. But eventually we have to remove some legacy fonts, the list can't be seen as append-only 😆.

silverwind added a commit that referenced this issue Apr 30, 2023
- Add `ui-monospace` to support Safari 13.4+.
- Add `SF Mono` variant to support the font on non-mac.
- Quote fonts as per [W3C
recommendation](https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#propdef-font-family).

> it is recommended to quote font family names that contain white space,
digits, or punctuation characters other than hyphens

Fixes: #22125
@saegl5
Copy link
Contributor Author

saegl5 commented May 1, 2023

@silverwind thanks again for following up

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants