TranslateProject/sources/tech/20171117 5 open source fonts ideal for programmers.md

8.5 KiB

5 open source fonts ideal for programmers

What is the best programming font? First, you need to consider that not all fonts are created equally. When choosing a font for casual reading, the reader expects the letters to smoothly flow into one another, giving an easy and enjoyable experience. A single character for a standard font is akin to puzzle piece designed to carefully mesh with every other part of the overall typeface.

When writing code, however, your font requirements are typically more functional in nature. This is why most programmers prefer to use monospaced fonts with fixed-width letters, when given the option. Selecting a font that has distinguishable numbers and punctuation, is aesthetically pleasing, and has a copyright license that meets your needs is also important.

There are certain features that make a font optimal for programming. First, a detailed definition of what makes a monospaced font is in order. Consider the letter "w" as it compares to the letter "i" for a moment. When you are dealing with a font, it is important to think about the whitespace around the letter, as well as the letter itself. In the world of physical books and newspapers, where efficient use of space is often critical, it makes sense to assign less width to the thin "i" than the wide "w."

There are certain features that make a font optimal for programming.

Inside a terminal, however, you are blessed with no such restrictions, and it can be very useful for every character to share an identical amount of space. The main functional benefit is that you can effectively "guesstimate" how long your code is by casually glancing at a block of text. Secondary benefits include the ability to align characters and punctuation easily, highlighting is much more visually obvious, and optical character recognition on printed sheets is more effective for monospaced fonts than proportional fonts.

Inside a terminal, however, you are blessed with no such restrictions, and it can be very useful for every character to share an identical amount of space. The main functional benefit is that you can effectively "guesstimate" how long your code is by casually glancing at a block of text. Secondary benefits include the ability to align characters and punctuation easily, highlighting is much more visually obvious, and optical character recognition on printed sheets is more effective for monospaced fonts than proportional fonts.

In this article we will explore five excellent open source font options that are ideal for programming and writing code.

1. Firacode: The best overall programming font

firacode.png

FiraCode example

FiraCode, Andrew Lekashman

firacode2.png

FiraCode compared to Fira Mono

FiraCode compared to Fira Mono, Nikita Prokopov via GitHub

2. Inconsolata: Elegant and created by a brilliant designer

inconsolata.png

Inconsolata example

Inconsolata, Andrew Lekashman

The first font on our list is FiraCode , a programming font that truly goes above and beyond the call of duty. FiraCode is an extension of Fira, the open source font family commissioned by Mozilla. What makes FiraCode different is that it modifies the common symbol combinations or ligatures used in code to be extraordinarily readable. This font family comes in several styles, notably including a Retina option. You can find examples for how it applies to many programming languages on its GitHub page.

Inconsolata is one of the most beautiful monospaced fonts. It has been around since 2006 as an open source and freely available option. The creator, Raph Levien designed Inconsolata with one basic statement in mind: "monospaced fonts do not have to suck." Two things that stand out about Inconsolata are its extremely clear differences between 0 and O and its well-defined punctuation.

3. DejaVu Sans Mono: Standard issue with many Linux distros and huge glyph coverage

dejavu_sans_mono.png

DejaVu Sans Mono example

DejaVu Sans Mono, Andrew Lekashman

Inspired by the copyrighted and closed Vera font family used in GNOME, DejaVu Sans Mono is an extremely popular programming font that comes bundled with nearly every modern Linux distribution. DejaVu comes packed with a whopping 3,310 glyphs under the Book Variant, compared to a standard font, which normally rests easy at around 100 glyphs. You'll have no shortage of characters to work with, it has enormous coverage over Unicode, and it is actively growing all of the time.

4. Source Code Pro: Elegant and readable, created by a small, talented team at Adobe

source_code_pro.png

Source Code Pro example

Source Code Pro, Andrew Lekashman

Designed by Paul Hunt and Teo Tuominen, Source Code Pro was produced by Adobe to be one of its first open source fonts. Source Code Pro is notable in that it is extremely readable and has excellent differentiation between potentially confusing characters and punctuation. Source Code Pro is also a font family and comes in seven different styles: Extralight, Light, Regular, Medium, Semibold, Bold, and Black, with italic variants of each.

source_code_pro2.png

Differentiating potentially confusable characters

Differentiating potentially confusable characters, Paul D. Hunt via Adobe Typekit Blog.

source_code_pro3.png

Metacharacters with special meaning in computer languages

Metacharacters with special meaning in computer languages, Paul D. Hunt via Adobe Typekit Blog

5. Noto Mono: Enormous language coverage, created by a large team at Google

noto.png

Noto Mono example

Noto Mono, Andrew Lekashman

The last font on our list is Noto Mono, the monospaced version of the expansive Noto font family by Google. While not specifically designed for programming, Noto Mono is available in 209 languages (including emoji!) and is actively supported and updated. The project is enormous and is an extension of Google's stated mission to organize the world's information. If you want to learn more about it, check out this excellent video about the font.

Choosing the right font

Whichever typeface you select, you will most likely spend hours each day immersed within it, so make sure it resonates with you on an aesthetic and philosophical level. Choosing the right open source font is an important part of making sure that you have the best possible environment for productivity. Any of these fonts is a fantastic choice, and each option has a powerful feature set that lets it stand out from the rest.


via: https://opensource.com/article/17/11/how-select-open-source-programming-font

作者:Andrew Lekashman 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出