Use Menlo as the default monospace font on macOS
Categories
(Core :: Layout: Text and Fonts, enhancement, P3)
Tracking
()
People
(Reporter: kohei, Assigned: jfkthame)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 1 obsolete file)
Reporter | ||
Updated•8 years ago
|
Comment 1•8 years ago
|
||
Updated•7 years ago
|
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Assignee | ||
Comment 5•4 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•4 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•4 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•4 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•4 years ago
|
Assignee | ||
Comment 9•4 years ago
|
||
Depends on D107285
Assignee | ||
Comment 10•4 years ago
|
||
Depends on D107286
Comment 11•4 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•4 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•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 13•4 years ago
|
||
Comment 14•4 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
Comment 17•4 years ago
|
||
Comment 18•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/931336f048ab
https://hg.mozilla.org/mozilla-central/rev/74e762c1fb14
Assignee | ||
Updated•4 years ago
|
Updated•3 years ago
|
Description
•