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

Closed
opened 2025-11-02 08:54:42 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @saegl5 on GitHub (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

Originally created by @saegl5 on GitHub (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"<br>(Default) | ui-monospace<br>(Changed) | | - | - | | <img width="997" alt="Screenshot 2023-04-29 at 9 49 41 PM" src="https://user-images.githubusercontent.com/63764270/235336157-1759611b-cb9f-4a49-b9c4-69c03961c7c0.png"> | <img width="997" alt="Screenshot 2023-04-29 at 9 50 21 PM" src="https://user-images.githubusercontent.com/63764270/235336161-ddda3df5-b902-49ef-a163-46d20c234906.png"> | | 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
GiteaMirror added the type/enhancementtopic/ui labels 2025-11-02 08:54:42 -06:00
Author
Owner

@silverwind commented on GitHub (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.

@silverwind commented on GitHub (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.
Author
Owner

@saegl5 commented on GitHub (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)

@saegl5 commented on GitHub (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)
Author
Owner

@gnat commented on GitHub (Dec 18, 2022):

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

@gnat commented on GitHub (Dec 18, 2022): Enabling this for mac users would be cool- I actually install SFMono on my Ubuntu machines too.
Author
Owner

@saegl5 commented on GitHub (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+)

@saegl5 commented on GitHub (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+)
Author
Owner

@silverwind commented on GitHub (Apr 30, 2023):

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 https://github.com/go-gitea/gitea/pull/24442 which does just that.

@silverwind commented on GitHub (Apr 30, 2023): 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 https://github.com/go-gitea/gitea/pull/24442 which does just that.
Author
Owner

@silverwind commented on GitHub (Apr 30, 2023):

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.

@silverwind commented on GitHub (Apr 30, 2023): 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.
Author
Owner

@wxiaoguang commented on GitHub (Apr 30, 2023):

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

@wxiaoguang commented on GitHub (Apr 30, 2023): But there are other OS and browsers ... not sure whether we haven enough confidence to remove some mono fonts.
Author
Owner

@silverwind commented on GitHub (Apr 30, 2023):

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

@silverwind commented on GitHub (Apr 30, 2023): Yeah it's a complicated topic. For now I've changed https://github.com/go-gitea/gitea/pull/24442 back to additions only. But eventually we have to remove some legacy fonts, the list can't be seen as append-only 😆.
Author
Owner

@saegl5 commented on GitHub (May 1, 2023):

@silverwind thanks again for following up

@saegl5 commented on GitHub (May 1, 2023): @silverwind thanks again for following up
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9972