Wikipedia:Typography

Source: Wikipedia, the free encyclopedia.

Typography, i.e. the use of fonts, on Wikipedia can often be a source of heated debates. This is because Wikipedia has never set an explicit font in its default skin. This was true for Monobook, and still holds for Vector. The base font for these skins are simply defined as font-family: sans-serif. Likewise, the size of fonts are also subject to debates. Vector uses the definition of font-size: 0.875em;, which translates to 87.5% of the default fontsize set in a user's browser. Under Windows, the default fonts in browsers are normally defined as Arial at 16px for sans-serif, Times New Roman at 16px for serif and Courier New at 13px for monospace. 0.875 × 16 equals 14px exactly. However, all fonts shown here are 16px, the browser's default.

Below are some personal writings on web typography, and its potential use on Wikipedia. It focuses on fonts that are installed by default, as these provide a stable installed base. It also focuses heavily on Windows. Information relating to other platforms is very welcome.

How to use other fonts in an article

Here are the tags to use if you wish to change the font in the text of an article.

Please note, fonts that have the same cap height, do not always match in x-height, making them hard to mix inline without scaling. Based on Arial as the base font, Comic Sans MS, Georgia, Trebuchet MS and Verdana are safe to use inline. Times New Roman is not safe to use inline without scaling. Although Courier New has a lower height, it remains legible, and is the de facto monospace font. (Arial Black and Impact are not listed, as these are header fonts.)

  • Here are examples of code to use, for various fonts.
  • Safe to use inline (see above for details):
    • <span style="font-family: Arial;">Arial</span>; the base font,
    • <span style="font-family: 'Comic Sans MS';">Comic Sans MS</span>,
    • <span style="font-family: Georgia;">Georgia</span>,
    • <span style="font-family: 'Trebuchet MS';">Trebuchet MS</span>
    • <span style="font-family: Verdana;">Verdana</span>
  • Not safe to use inline (see above for details):
    • <span style="font-family: 'Times New Roman';">Times New Roman</span>
    • <span style="font-family: 'Courier New';">Courier New</span>

  • below is how the font codes above would look when actually used.
  • Safe to use inline (see above for details):
    • Arial, the base font
    • Comic Sans MS
    • Georgia
    • Trebuchet MS
    • Verdana
  • Not safe to use inline (see above for details):
    • Times New Roman
    • Courier New

Legacy font names

On Macs,

Times, and Courier are three core fonts used by Adobe's PostScript and PDF
technologies. All three fonts have been included on every Mac going back to the 1980s, and they are the default "sans-serif", "serif", and "monospace" fonts in almost all web browsers.

On early versions of Windows, these names referred to pixelated versions of the core PostScript fonts. As technology improved, rather than adopting the Mac fonts, Microsoft substituted Helvetica with Arial, Times with Times New Roman, and Courier with Courier New. All six of the aforementioned fonts have been included on Macs since the 2000s.

Font Sample Variants Windows substitute
Helvetica The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic Arial
Times
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic Times New Roman
Courier The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic Courier New

Available fonts

Core fonts for the Web

Font Sample Variants
Arial The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Times New Roman The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Courier New
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Comic Sans MS
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Georgia The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Trebuchet MS The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Verdana The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic

Availability

The Core fonts for the Web have an installed base of 99% on Windows[1] (except Andalé Mono) and 92–98% on Mac OS X platforms,[2] as they are now part of the standard installation. Despite the necessity to install these fonts separately, they still enjoy an installed base of 65% among Linux installations.[3]

Originally part of the Core Web fonts, Andalé Mono is not installed with Windows (having been replaced by Lucida Console), resulting in only 4% of Windows installations having the font, as opposed to 92% on Mac OS X. It used to be shipped with Internet Explorer until version 6, and was only installed with Windows 98. As the fonts are still available online, it does have an installed base of 70% on Linux. As it is similar and metric-compatible to Lucida Console, it is recommended to always combine Lucida Console and Andalé Mono in a font stack.

iOS has all the fonts listed in the table above, except Andalé Mono and Comic Sans MS. However, it does have a Comic Sans–like font called Chalkboard SE. Consider using this CSS font stack: font-family: "Comic Sans MS", Chalkboard SE, cursive, sans-serif;

Size

Note: This section holds true for 13px, but since the Typography Refresh, most fonts no longer match in 14px.

Fonts that have the same cap height do not always match in x-height, making them hard to mix inline without scaling. Based on Arial as the base font, Comic Sans MS, Georgia, Trebuchet MS and Verdana are safe to use inline. Times New Roman is not safe to use inline without scaling. Although Courier New has a lower height, it remains legible, and is the de facto monospace font. (Arial Black and Impact are not listed, as these are header fonts.)

Header fonts

Arial Black and Impact are part of the set of core fonts for the web, but they are very heavy designs that are only recommended for use at large sizes. In addition, Arial Black is not installed on iOS devices. Furthermore, Impact is not installed on ChromeOS devices or older iOS devices.

Font Sample Variants
Arial Black The Quick Brown Fox Jumps Over The Lazy Dog. Black
Impact The Quick Brown Fox Jumps Over The Lazy Dog. Regular

Common Windows fonts

Font Since Sample Variants
Tahoma Windows 98 The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold
Lucida Sans Unicode Windows 98 The Quick Brown Fox Jumps Over The Lazy Dog. Regular
Lucida Console
Windows 98 The Quick Brown Fox Jumps Over The Lazy Dog. Regular
Microsoft Sans Serif Windows 2000 The Quick Brown Fox Jumps Over The Lazy Dog. Regular
Palatino Linotype
Windows 2000 The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Franklin Gothic Medium
Windows XP The Quick Brown Fox Jumps Over The Lazy Dog. Medium, Medium Italic
Segoe UI
Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Calibri Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Cambria Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Candara Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Consolas Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Constantia Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Corbel Windows Vista The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic

All but Palatino Linotype and Segoe UI have one major drawback: they all come without bold and/or italic variants. The "new" Windows ClearType font family introduced in Windows Vista has consistent font metrics, but these do not match with the core web fonts listed above, so they need to be scaled when mixed.

On Mac, Tahoma and Microsoft Sans Serif have been part of the standard installation of macOS since 2007 (Mac OS X Leopard). Macs do not have Palatino Linotype, but they do have the PostScript version of Palatino, which looks the same but has slightly different metrics (i.e. height and width of characters). You can ensure Mac and Windows users get a similar experience by using this CSS font stack: font-family: Palatino, "Palatino Linotype", serif;

The other fonts in this list (e.g. Cambria, Calibri), come with Microsoft Word for Mac, but are not installed system-wide on newer (post-2011) versions. Regardless, since not all Macs have Word, you can't count on those fonts being installed. Segoe UI is not available on Mac through legitimate means. None of these fonts are available on iOS.

Common Linux fonts

Font Sample Variants
Nimbus Sans L
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Nimbus Roman No9 L
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Nimbus Mono L The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Century Schoolbook L
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
URW Gothic L The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
URW Bookman L
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
URW Palladio L The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
DejaVu Sans
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
DejaVu Serif
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
DejaVu Sans Mono
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Liberation Sans
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Liberation Serif
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
Liberation Mono
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
FreeSans
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
FreeSerif
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic
FreeMono
The Quick Brown Fox Jumps Over The Lazy Dog. Regular, Bold, Italic, Bold Italic

Monospaced fonts

When displaying code, a monospaced font helps keep code readable and maintain formatting consistent, but there are caveats. Below are some common monospaced fonts.

Font Sample Supported platforms
Courier The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Mac

(replaced by Courier New on Windows)

Courier New The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Windows, Mac
Consolas The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Windows
Lucida Console The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Windows
Andale Mono The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Mac
Menlo The Quick Brown Fox Jumps Over The Lazy Dog.
The Quick Brown Fox Jumps Over The Lazy Dog.
Mac

Not all monospaced fonts come with a bold weight variant, causing bold text to misalign with the rest of the text. Andalé Mono and Lucida Console suffer badly from this. That leaves Courier, Courier New, Menlo and Consolas as the only safe choices when bold and italic highlighting is used. Courier New is the safest choice as it is the only monospaced font that is guaranteed to look the same on both Windows and Mac. However, Courier and Courier New are serif fonts, and sans-serif monospaced fonts are typically used for coding. That leaves Menlo and Consolas as the only sans-serif coding fonts. However, since Menlo and Consolas aren't included in both Windows and macOS at the same time, consider using Menlo and Consolas in a font stack.

Starting in 2020, Firefox for Mac has started using Menlo (instead of Courier) as the default "monospace" font.

The monospace "bug"

When viewing monospaced text here on Wikipedia, sometimes it is shown too small. This is not a bug, but a result of the combination of a website's default font size and the browser's default font size for monospace. By default, a (Windows) browser has its default font sizes set at 16px for serif and sans-serif, and 13px for monospace.

Vector has a base font size of 0.875em, and most browsers—except Firefox—correctly scale down all fonts, including the monospaced font, accordingly. So monospace is shown at 0.875 × 13px = 11px (which is perceived as "too small"). Compensating the font-size will render the font too big in Firefox. The solution is to assign any font besides just "monospace", for example font-family: monospace, monospace; or font-family: monospace, Courier;. The browsers will ignore the second value. But it will no longer use the configured "monospace" font size and instead use the same size as sans-serif.

Emoji fonts

When describing emojis, it helps to use a font that actually includes the glyph for that emoji. Most recent operating system versions include an emoji font. Below are some common emoji fonts.

Font Sample Supported platforms
Segoe UI Emoji 🩷💀🫱🏿‍🫲🏻🌴🐢🐐🍄⚽🫧👑📸🪼👀🚨🏡🕊️🏆😻🌟🧿🍀🫶🏾 Windows[4]
Apple Color Emoji 🩷💀🫱🏿‍🫲🏻🌴🐢🐐🍄⚽🫧👑📸🪼👀🚨🏡🕊️🏆😻🌟🧿🍀🫶🏾 iOS, macOS, tvOS, watchOS[5]
Noto Color Emoji 🩷💀🫱🏿‍🫲🏻🌴🐢🐐🍄⚽🫧👑📸🪼👀🚨🏡🕊️🏆😻🌟🧿🍀🫶🏾 Android, ChromeOS, Linux[a]
  1. ^ Noto Color Emoji is preinstalled on some Linux distributions like Ubuntu, Debian, Fedora, and postmarketOS, but not on others like Arch.

In the CSS Fonts Module Level 4 working draft, emoji is a valid generic font family.[6] This is already supported in most modern browsers[7] and can be used to get the operating system's default emoji font with font-family: emoji;, optionally prepending concrete emoji font names.

Mozilla Firefox and Thunderbird also package Twemoji Mozilla, derived from Twemoji, and use it as a fallback if a system-wide emoji font isn't available.[8][9]

  • Here are example emojis without overriding the font:
    • 😀♥✏⚠⤴⤵
  • Here are example emojis with font-family: emoji;:
    • 😀♥✏⚠⤴⤵

See also

References

  1. ^ "Windows font survey results". Code Style. Archived from the original on 2013-04-25.
  2. ^ "Mac font survey results". Code Style. Archived from the original on 2012-02-10.
  3. ^ "Linux font survey results". Code Style. Archived from the original on 2012-03-15.
  4. ^ "Segoe UI Emoji font family". 6 December 2021. Retrieved 6 September 2023.
  5. ^ "System Fonts - Fonts - Apple Developer". 6 September 2023. Retrieved 6 September 2023.
  6. ^ "CSS Fonts Module Level 4". 21 December 2021. Retrieved 6 September 2023.
  7. ^ "font-family - CSS: Cascading Style Sheets". 6 September 2023. Retrieved 6 September 2023.
  8. ^ Mozilla (October 28, 2022). "twemoji-colr: Twemoji font in COLR/CPAL layered format". GitHub.
  9. ^ "Determine if we still need to load TwemojiMozilla.ttf". January 12, 2021.

External links