C# console font

可紊 提交于 2020-01-20 08:32:12

问题


I cannot find out which font the console app uses by default? Is it guaranteed that everyone has that font (when running this .NET app)? Want to display some unicode chars and need to be sure they are present within that font. Thanks


回答1:


I strongly recommend avoiding the Console if you want to use Unicode characters. There are many issues with trying to get the Console to display Unicode correctly.

Unicode is not directly supported in Console output. The best option is typically to set the console's code page, which will require P/Invoke.

That being said, a GUI solves all of these issues, in a much nicer fashion. If you need Unicode output, I'd recommend a simple GUI.




回答2:


You can tell what font is being used by reading the registry value "0" from this key:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont


来源:https://stackoverflow.com/questions/3971684/c-sharp-console-font

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