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

134 lines
8.5 KiB
Markdown
Raw Normal View History

5 open source fonts ideal for programmers
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documentation-type-keys-yearbook.png?itok=Q-ELM2rn)
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][1]
![FiraCode example][2]
FiraCode, Andrew Lekashman
### [firacode2.png][3]
![FiraCode compared to Fira Mono][4]
FiraCode compared to Fira Mono, [Nikita Prokopov][5] via GitHub
### 2. Inconsolata: Elegant and created by a brilliant designer
### [inconsolata.png][6]
![Inconsolata example][7]
Inconsolata, Andrew Lekashman
The first font on our list is [FiraCode][5] , 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][5] page.
[Inconsolata][8] 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][9]
![DejaVu Sans Mono example][10]
DejaVu Sans Mono, Andrew Lekashman
Inspired by the copyrighted and closed Vera font family used in GNOME, [DejaVu Sans Mono][11] 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][12]
![Source Code Pro example][13]
Source Code Pro, Andrew Lekashman
Designed by Paul Hunt and Teo Tuominen, [Source Code Pro][14] was [produced by Adobe][15] 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][16]
![Differentiating potentially confusable characters][17]
Differentiating potentially confusable characters, [Paul D. Hunt][15] via Adobe Typekit Blog.
### [source_code_pro3.png][18]
![Metacharacters with special meaning in computer languages][19]
Metacharacters with special meaning in computer languages, [Paul D. Hunt][15] via Adobe Typekit Blog
### 5. Noto Mono: Enormous language coverage, created by a large team at Google
### [noto.png][20]
![Noto Mono example][21]
Noto Mono, Andrew Lekashman
The last font on our list is [Noto Mono][22], 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][23].
### 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][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com
[1]:/https://opensource.comfile/377151
[2]:https://opensource.com/sites/default/files/u128651/firacode.png (FiraCode example)
[3]:https://opensource.com/file/377156
[4]:https://opensource.com/sites/default/files/u128651/firacode2.png (FiraCode compared to Fira Mono)
[5]:https://github.com/tonsky/FiraCode
[6]:https://opensource.com/file/377161
[7]:https://opensource.com/sites/default/files/u128651/inconsolata.png (Inconsolata example)
[8]:http://www.levien.com/type/myfonts/inconsolata.html
[9]:https://opensource.com/file/377146
[10]:https://opensource.com/sites/default/files/u128651/dejavu_sans_mono.png (DejaVu Sans Mono example)
[11]:https://dejavu-fonts.github.io/
[12]:https://opensource.com/file/377171
[13]:https://opensource.com/sites/default/files/u128651/source_code_pro.png (Source Code Pro example)
[14]:https://github.com/adobe-fonts/source-code-pro
[15]:https://blog.typekit.com/2012/09/24/source-code-pro/
[16]:https://opensource.com/file/377176
[17]:https://opensource.com/sites/default/files/u128651/source_code_pro2.png (Differentiating potentially confusable characters)
[18]:https://opensource.com/file/377181
[19]:https://opensource.com/sites/default/files/u128651/source_code_pro3.png (Metacharacters with special meaning in computer languages)
[20]:https://opensource.com/file/377166
[21]:https://opensource.com/sites/default/files/u128651/noto.png (Noto Mono example)
[22]:https://www.google.com/get/noto/#mono-mono
[23]:https://www.youtube.com/watch?v=AAzvk9HSi84