Proposal
The purpose of this proposal is to extend the monospace font-stack to cater to professional contributors who have installed one of the following modern typefaces designed for source code. This would benefit serious contributors and has no effect on regular users.
Proposed fonts:
- 'Fira Code' - Webfont, monospaced font with programming ligatures.
- 'Hack' - Webfont, a typeface designed for source code - large x-height + wide aperture + low contrast + custom zero.
- 'Source Code Pro' - Webfont from Adobe, "has been designed to work well in coding environments".
- 'Inconsolata' - Favored for its legibility with small font-size.
Affected products
Products (skins, extensions, other) that opt-in to import and use this font-stack definition that would be defined in WikimediaUI Base.
Currently only Skin:MinervaNeue, VisualEditor and JsonConfig follow (by copying) those definitions.
Products that can benefit from it
- new Skin:Vector (Desktop Improvements project)
- Skin:MinervaNeue (mobile)
- Skin:Timeless (up to Isarra)
- Skin:Example
- Extensions: Visual Editor, CodeEditor, Flow, etc. (unified, all)
- JSDoc WMF theme (T209562)
Current status
Wikimedia Design Style Guide -- Typography
Declaration in WikimediaUI: wikimedia-ui-base.less line 205
core.git /resources/lib/ooui/wikimedia-ui-base.less
@font-family-monospace: 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace; @font-family-monospace--fallback: monospace, monospace; // See T176636
Minerva:
// Provide better operating system-specific monospace stack, see T209915. @font-family-monospace: 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace; @font-family-monospace--fallback: monospace, monospace; // See T176636
Timeless:
@fonts-mono: 'Menlo', 'Consolas', 'Monaco', 'Noto Mono', 'Nimbus Mono L', monospace;
Material:
@md-ui-typography-roboto-mono: 'Roboto Mono', 'Courier New', Courier, 'Lucida Sans Typewriter', 'Lucida Typewriter', monospace;
CodeEditor (.ace_editor):
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;
The rest uses the system default.
Proposed declaration
Previously (sample): https://gerrit.wikimedia.org/r/c/mediawiki/core/+/570597/12/resources/src/mediawiki.less/wikimedia-ui-fonts.less#72
// Fonts typically available installed by the OS: // 'Menlo', 'Monaco': new Mac, old Mac; Noto Mono: ?; 'Liberation Mono', 'Nimbus Mono L': GNU+Linux; 'Consolas': Window; 'Inconsolata': generic, small; 'Ubuntu Mono': GNU+Linux, small; Courier New: Windows, small @font-family-system-monospace: 'Menlo', 'Monaco', 'Noto Mono', 'Liberation Mono', 'Nimbus Mono L', 'Consolas', 'Inconsolata', 'Ubuntu Mono', 'Courier New', monospace; // Fonts optionally installed by the user: 'Fira Code': webfont, ligatures; 'Hack': webfont; 'Source Code Pro': webfont, Adobe @font-family-monospace: 'Fira Code', 'Hack', 'Source Code Pro', @font-family-system-monospace;
Note: This proposal is NOT proposing to rename these variables to @ff-mono and @ff-system-mono.
Prior art
- -> T209915: Typography: Define a font stack for monospace fonts -- The most extensive documentation of the design decisions regarding the monospace font-stack.
- T176636: Unify CSS font stack of monospace-styled elements across products -- Patches across products to unify font-family: monospace, monospace;
- T209562: Font family for code needs improvement
- T221043: Apply operating system font stack to MinervaNeue monospace elements
Questions
- Are there any issues with the 4 fonts that are the primary focus of this task? 'Fira Code', 'Hack', 'Source Code Pro', 'Inconsolata'
- Are there any issues with including 'Monaco', 'Noto Mono', 'Nimbus Mono L' from Skin:Timeless?
- Are there any issues with the order of preference for the added fonts?
- The reason for 'Inconsolata' being after 'Consolas' is the small font metrics, similar to 'Ubuntu Mono'.
- Should the fonts from "Material" skin be included? 'Roboto Mono', 'Lucida Sans Typewriter', 'Lucida Typewriter'
- How to gather feedback from the community? Most editors aren't affected by this change.