Make the Code look more comfortable (2): select the appropriate font

Source: Internet
Author: User

From: http://www.cnblogs.com/xiaoshatian/archive/2009/11/23/1608432.html

Font is not only an important weapon in the hands of designers. For our developers, there are also many exquisite font choices. A good font suitable for displaying code should have the following elements:

  • Equal-width characters
  • Concise, clear, and standard character shapes
  • Supports extended character sets with ASCII codes greater than 128
  • Spaces of the same width as characters
  • Easy-to-distinguish lowercase letters (L), uppercase letters (I), numbers (1), and symbols |
  • Easy-to-distinguish uppercase letters (o) and numbers (0)
  • Easy to distinguish between the front and back quotes, preferably symmetric
  • Other punctuation characters that are easy to distinguish, especially braces, brackets, Parentheses, and angle brackets
  • Excellent Chinese support and display

It presents an extreme inverse example. Although it has personality, it is not suitable for displaying code. The uppercase letters are terrible, but the lowercase letters are poor. The characters are not clear but not standard. The lowercase letters l, uppercase letters I, numbers 1 and symbols | difficult to distinguish; it is difficult to distinguish the uppercase letters "O" and the numbers "0". The punctuation marks are still merged. Why is the underline broken?

Of course, this counterexample is indeed exaggerated, but the conditions listed above are harsh. We do not have to fully satisfy all the conditions when selecting a font. In fact, this font is also rare. Some fonts shared below do not fully meet all the requirements. We found that as long as some of the key requirements are met, it is good to display the code.

In Visual Studio, changing the font of the editor is simple. Choose 【Tools]【Option], In the pop-up"OptionIn the dialog box, select"EnvironmentAndFont and color", And thenDisplay its settings", Select"Text EditorAt the end ofFontSelect the font, as shown in:

In, we found that Visual Studio has identified the same width font in bold, so that we can more easily find the same width font. It does not mean that the same width font must be suitable for displaying code, for example, the "" is an inverse example:

In the New Song Dynasty, the ratio of numbers 0 to uppercase letters o is a little thin, and the lowercase letters l and number 1 are also very similar. Fortunately, the color scheme can distinguish them from each other, otherwise it is difficult to distinguish. This also illustrates from another perspective that the color scheme and font complement each other. Matching exactly at that time will make the code clearer and easier to distinguish.

Next I will share with you some famous fonts in the programming field. The color scheme used is humanestudio, and the display order is the ascending order of the first letter of the font. These fonts may all look the same at first glance. However, you can still find different fonts that suit your needs.

Andale mono. The demo font size is 14. Click here to download:

Anonymous pro. The demo font size is 14. Click here to download it:

Bitstream Vera sans mono. The demo font size is 14. Click here to download it:

Consolas, the demo font size is 14, windows or Visual Studio is built in:

Courier New, the demo font size is 14, and Windows has built-in:

Dejavu sans mono. The demo font size is 14. Click here to download it:

Envy code R. The demo font size is 16. Click here to download it:

Inconsolata: the demo font size is 16. Click here to download:

Monaco: the demo font size is 12. Click here to download it:

Monofur: the demo font size is 16. Click here to download:

Progmata. The demo font size is 14. Click here to download it:

Share techmono. The demo font size is 16. Click here to download it:

Note: This font seems to display the link FL as a dot. It is a pity that it is not recommended.

Note: All fonts shared in this article support cleartype.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.