Use Menlo as the default monospace font on macOS
Categories
(Core :: Layout: Text and Fonts, enhancement, P3)
Tracking
()
People
(Reporter: kohei.yoshino, Assigned: jfkthame)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 1 obsolete file)
+++ This bug was initially created as a clone of Bug #713680 +++ So Firefox 55 will change the default monospace font on Windows. Is it a good time to change the one on macOS as well? So far Courier or Courier New is used for many locales. I'd suggest Menlo [1] which is the default monospace font on Visual Studio Code and other editors [2]. [1] https://en.wikipedia.org/wiki/Menlo_(typeface) [2] https://spin.atomicobject.com/2016/07/11/programming-fonts/
Reporter | ||
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Good suggestion. The Menlo font has been included in macOS since 10.6 (Snow Leopard), so it's available on all versions of macOS supported by Firefox.
Updated•6 years ago
|
Whats about San Francisco, which is the system font for macOS, iOS, watchOS, and tvOS? https://developer.apple.com/fonts/
Comment 3•6 years ago
|
||
(In reply to Nomis101 from comment #2) > Whats about San Francisco, which is the system font for macOS, iOS, watchOS, > and tvOS? > https://developer.apple.com/fonts/ Which macOS versions ship the new San Francisco font (or, more specifically, the monospace variant "SF Mono")? Firefox supports macOS 10.9 and later. Wikipedia says San Francisco was made the new default system font in macOS 10.11 (El Capitan), but doesn't say if the font was available in 10.9 and 10.10 as a non-default option.
(In reply to Chris Peterson [:cpeterson] from comment #3) > Which macOS versions ship the new San Francisco font (or, more specifically, > the monospace variant "SF Mono")? Firefox supports macOS 10.9 and later. > Wikipedia says San Francisco was made the new default system font in macOS > 10.11 (El Capitan), but doesn't say if the font was available in 10.9 and > 10.10 as a non-default option. Thats true, SF was introduced in 10.11 to replace Helvetica Neue. It is not available in 10.9 or 10.10.
Updated•6 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
SF Mono isn't accessible to content on current macOS (Big Sur), at least, as it's a hidden system font (actually named ".SF NS Mono") only usable via Core Text UI font APIs that we don't currently use.
Switching to Menlo as the default for CSS monospace
may be an option; I've pushed a try job to see what breaks.
Comment 6•2 years ago
|
||
It would be nice if we could update the monospace font in Fx88 or Fx89 in time for the Proton UI refresh in Fx89.
Assignee | ||
Comment 7•2 years ago
|
||
Switching from Courier to Menlo does result in some test breakage, e.g. see https://treeherder.mozilla.org/jobs?repo=try&revision=369050bb706e7ee680796f36ceb50e34354b6b93. (We get a few "unexpected pass" as well as "unexpected fail", actually.)
Many of these "failures" are irrelevant changes to slightly-fuzzy tests, and we can just adjust metadata as needed. The one "real" issue I see relates to hyphenation tests: a number of these fail because Menlo happens to have visually distinct glyphs for the Unicode character U+2010 HYPHEN vs the ASCII-derived U+002D HYPHEN-MINUS. Our auto-hyphenation code renders hyphen as U+2010 if available in the font (with fallback to U+002D), but the testcases compare against reference files that use U+002D.
We can't simply update the reference files to use U+2010, because then the tests would fail in an environment where the font being used doesn't support this codepoint (or if a browser chose U+002D as its preferred auto-hyphenation character).
So to work around this, I propose to update those testcases to explicitly say font-family: Courier New, Courier, monospace
in place of the bare monospace
generic. That means they'll use Courier [New] if available, avoiding the Menlo quirk on macOS, but otherwise they will happily run with whatever generic monospace
is provided.
Assignee | ||
Comment 8•2 years ago
|
||
Without this fix, changing the macOS monospace font causes this test to start failing.
The use of getCharacterDims() to figure out target points in terms of character size is slightly off,
because the result of getBoundingClientRect includes the border around the element. So to get the
actual advance of the individual character, we need to subtract that. This accounts for the unexpected
platform-dependent result of the "split selection" test, because across the width of 4 characters
the error accumulates by a platform-dependent factor (depending on the ratio of the true character
width to the constant extra amount due to the border).
(This patch does not address the fact that selectAtPoint is selecting two adjacent characters when
only one would be expected; that is a bug to be handled separately. This just makes the existing
test more accurate/consistent.)
Depends on D107284
Updated•2 years ago
|
Assignee | ||
Comment 9•2 years ago
|
||
Depends on D107285
Assignee | ||
Comment 10•2 years ago
|
||
Depends on D107286
Comment 11•2 years ago
|
||
For some additional context, Safari allows web content to use SF Mono as ui-monospace
, see https://webkit.org/blog/10247/new-webkit-features-in-safari-13-1/ .
Assignee | ||
Comment 12•2 years ago
|
||
Yes, that's what I'd expect ui-monospace
to map to (for Latin etc). We haven't implemented any of the new ui-*
generics yet (and we really should move to the proper CTFont APIs for this, rather than just creating -- and having to maintain -- yet more prefs font lists to handle them).
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 13•2 years ago
|
||
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/02b69c938fbe Use Menlo as default monospace font on macOS. r=mstange https://hg.mozilla.org/integration/autoland/rev/1154df798888 Adjust a few testcases that are sensitive to glyph/metrics differences in Menlo. r=mstange
Comment 14•2 years ago
|
||
Backed out 3 changesets (bug 1696176, bug 1342741) for test_nsIHTMLEditor_getSelectedElement.html and inert-retargeting-iframe.tentative.html failures.
Push with failures:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&fromchange=a0f0682883e1db93f88a6ed4b87ee79bf2d22d31&test_paths=editor%2Flibeditor%2Ftests&selectedTaskRun=ZKyhNDRQQPiqjsuMQSi8UA.0&tochange=d1e50e1cfdd8f73c5f5d6516e96dd1963d159061
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&fromchange=2760de845c282752271101abe78c834d82304587&test_paths=inert&tochange=d1e50e1cfdd8f73c5f5d6516e96dd1963d159061&selectedTaskRun=HfZU9jWEQs6QheO_LtXahw.0
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&fromchange=a0f0682883e1db93f88a6ed4b87ee79bf2d22d31&selectedTaskRun=B873jyEMRPqzyGw0FtQakg.0&test_paths=pointerevents%2Fcompat&tochange=d1e50e1cfdd8f73c5f5d6516e96dd1963d159061
Backout link: https://hg.mozilla.org/integration/autoland/rev/d1e50e1cfdd8f73c5f5d6516e96dd1963d159061
Failures logs:
https://treeherder.mozilla.org/logviewer?job_id=332707338&repo=autoland&lineNumber=8715
https://treeherder.mozilla.org/logviewer?job_id=332703877&repo=autoland&lineNumber=2496
https://treeherder.mozilla.org/logviewer?job_id=332699089&repo=autoland&lineNumber=4717
https://treeherder.mozilla.org/logviewer?job_id=332704117&repo=autoland&lineNumber=17178
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28009 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Comment 17•2 years ago
|
||
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/931336f048ab Use Menlo as default monospace font on macOS. r=mstange https://hg.mozilla.org/integration/autoland/rev/74e762c1fb14 Adjust a few testcases that are sensitive to glyph/metrics differences in Menlo. r=mstange
Comment 18•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/931336f048ab
https://hg.mozilla.org/mozilla-central/rev/74e762c1fb14
Upstream PR merged by moz-wptsync-bot
Assignee | ||
Updated•2 years ago
|
Updated•1 year ago
|
Description
•