With a quick registry edit and the right type of font, you can add to the font list on the Command Prompt's Font tab.
In a recent Quick Tip article, I showed you how to calculate the appropriate value to use when configuring a Command Prompt window so that it will fill the screen when maximized. As I explained in that article, as you begin experimenting with a larger Command Prompt window, you may find that the default font is too small and as such you may want to adjust the font size.
While in my example, I stuck with the default font, many of you noticed that the Font tab on the Command Prompt Properties dialog box, shown in Figure A, contains two TrueType fonts and wondered if it is possible to add other fonts to the list. Fortunately, the answer is yes; with a quick registry edit and the right type of font, you can add to the font list on the Command Prompt's Font tab. This technique will work in Windows XP, 7, and 8. Let's take a closer look.
The Command Prompt's Font list contains two TrueType fonts.
Understanding the Fonts
To begin with, it is important to understand that the fonts used in the Command Prompt, must be monospaced fonts. In other words, the font's characters must all occupy the exact same amount of horizontal space.
In addition to the monospaced criteria, Microsoft also specifies that the font for the Command Prompt:
- Cannot be an italic font
- Cannot have a negative A or C space
- Must be FF_MODERN if it is a TrueType font
- Must be OEM_CHARSET if it is not a TrueType font
If you look at the Font list shown in Figure A you can see that, by default, the Command Prompt is configured to a font type called the Raster Fonts. These fonts, which also go by the name Terminal, are a special type of font whose characters are made up of bitmap images. Since all these images are the same width, Terminal is essentially a monospaced font.
Because Raster Fonts are no longer viable, over the years, Microsoft created monospaced TrueType fonts that could be used in the Command Prompt. The first was Lucida Console which was followed later by Consolas. At this point in time, these are the only monospaced TrueType fonts that come with Windows. All the other TrueType fonts that come with Windows are variable-width fonts, where the characters can all be different widths. As such, you cannot use those fonts in the Command Prompt.
Since Windows only comes with two monospaced TrueType fonts, if you want to add additional fonts to the Command Prompt, you will have to start by tracking down monospaced fonts. As you know, some Windows applications will add new fonts to Windows when you install them, so you might have other monospaced fonts on your system. Alternatively, you can download monospaced fonts from the Internet.
Now, before you proceed with locating monospaced fonts, you need to keep in mind that not all third-party monospaced TrueType fonts will be recognized as a Command Prompt font. However, there is really no easy way to tell if a font will work until you try it. With that in mind, let's proceed.
As I mentioned, you may already have other monospaced fonts installed in your system. If you are not sure if any of the fonts that you have installed on your system are monospaced fonts, here's a quick way to find out. Open WordPad and type a series of i's on one line and then a series of w's on a second line. Then, highlight the two lines, pull down the Font list, select different fonts, and look at the lines. If the lines are the same width, as shown in Figure B, then the font is monospaced. If the w's line is longer than the i's line, as shown in Figure C, then the font is variable-width.
Here you can see that the Consolas font is a monospaced font.
The Calibri font, like the majority of the fonts in Windows, is a variable-width font.
The good news is that there actually quite a few monospaced fonts to be had. The reason for this availability is that many developers prefer using monospaced fonts because the character's even width makes it easy to keep track of special characters in their programming code. As such, there are a lot of free monospaced fonts that you can download from the Internet.
For example, you can find examples of a host of monospaced fonts, along with links to download them, on the Code Project site in the article titled Font Survey: 42 of the Best Monospaced Programming Fonts. (Please remember to exercise caution when downloading free fonts from the Internet as some sites are not as reputable as you might hope.)
When you do download a TrueType font, you can easily install it in Windows. To do so, just right click on the TTF file and select Install from the context menu. For example, I found and downloaded a monospaced TrueType font called Droid Sans Mono and installed it as shown in Figure D.
You can install TrueType fonts in Windows from the context menu.
Adding the font to the registry
Using the Windows Registry Editor incorrectly can cause serious problems with your computer systems, which may then require the re-installation of your operating system and possible loss of data. TechRepublic does not support problems that arise from editing your registry. Use the Registry Editor and the following directions at your own risk.
Once you have added a monospaced font to Windows, you will have to make a small registry edit to make the font available in the Command Prompt. Adding information about the font to the registry is easy. To begin, launch the Registry Editor by pressing [Windows]+R to access the Run dialog box, typing Regedit in the open text box, and clicking OK. Then, open the following subkeys:
When you open the TrueTypeFont subkey, you'll see that the Lucida Console and Consolas fonts are listed with the names 0 and 00 respectively, as shown in Figure E. To add your font to the registry, pull down the Edit menu and select the New | String Value command. Now, when adding additional fonts via a Registry entry, it is important to know that the name needs to be incremented with a 0 for each additional font that you add. So in this case, you will rename the new value to 000. (If you were to add another font, its name would be 0000.)
The Lucida Console and Consolas fonts are listed with the names 0 and 00 respectively.
To continue, double-click the value to bring up the Edit String dialog box and type the name of the font in the Value data box, as shown in Figure F. Be sure to type the exact name of the font. To complete the operation, click OK, close the Registry Editor, and restart Windows.
You'll use the name of the font as the Value data.
Enabling your font
When Windows restarts, open a Command Prompt window, access the Properties dialog box, and select the Font tab. You may now see your font in the Font list. As I mentioned earlier, keep in mind that not all third-party monospaced TrueType fonts will be recognized as a Command Prompt font. While writing this article, I tried several fonts that simply would not appear in the Command Prompt's Font list.
In the case of my example, the Droid Sans Mono font is now available in the Font list, as you can see in Figure G.
In this example, the Droid Sans Mono font appears in the Command Prompt Font list.
You can now select your font, choose a size, and even make the font bold by selecting the Bold fonts check box. To see your new font in action, just click OK.
Keep in mind that when you change the font, it may alter the size of your maximized Command Prompt window. As such, you may have to repeat the steps in the Maximize a Command Prompt window the right way tip.