How can I change console font?

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

I have a problem with output Unicode in Windows XP console. (Microsoft Windows XP [Version 5.1.2600]) First code is that(from http://www.siao2.com/2008/03/18/8306597.aspx)


I changed HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\FontName, but when I check Prompt's properties -> Font, it set as 'Lucida Console'. Is there any way to change console font with API?

The next code is what I tried. But it doesn't work. Help.

  

PS : BTW, when I put "include < fcntl.h >" in "code tag", the part with in <> (fcntl.h) disappeared. How can I put system include?

回答1:

Found these instructions through Google here:
http://keznews.com/3308_Adding_fonts_to_cmd_exe

Be default, the properties on a cmd.exe window allow you to select either Raster Fonts or Lucida Console. You can add other monospace fonts to the list via the registry.

In regedit, navigate to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ Console\TrueTypeFont

Notice that Lucida Console is already under this key with a name of "0".

Add a new sting value with the name "00" (yep, that's the required name) and set the data to the name of a monospace font already installed in your C:\Windows\Fonts folder. In this example, I added the Consolas font. It seems that additional entries require names "000", "0000", etc. Names like "1" and "2" don't work. For Pete's sake, why?

Open up a new cmd window, right-click on the system menu, select Properties | Font and there is the newly added font.

I did this because I wanted a more readable font for my PowerShell window, since I've been spending some time staring at it.

source: ferncrk.com

I followed the instructions and made Consolas my default font for cmd. It worked as expected.

Note that it will only accept monospaced fonts.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!