Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

can't get FONT/N to work

I have set CHCP 65001 (for UTF-8). I have a .bat script (burried somewhere in the Microsoft Visual Studio\2019 directories) that changes TCC's font to a raster font, after which I can't see UTF-8 output in Take Command.
I expected to change the font back with FONT /N"Consolas", but I can't get it to work, not from Take Command, not from a a TCC windows detached from Take Command, and not from a TCC started alone.
TCC 31.01.22 x64 Windows 10 [Version 10.0.17763.5329]
 
FONT is only for standalone console windows. For Take Command, use the TCFONT command.

That said... Yeah, FONT doesn't seem to be working for me either. I suspect this command is just a wrapper around SetCurrentConsoleFontEx(), which is a pretty flakey API even by Microsoft standards. Hopefully Rex will come up with a workaround.
 
Try the SETFONT command from the 4CONSOLE plugin.

The plugin can be copied to your system from TCC;
Code:
E:\Utils>copy ftp://vefatica.net/4plugins/X64/4console64.zip r:\ 
ftp://vefatica.net/4plugins/X64/4console64.zip => R:\4console64.zip
     1 file copied

Joe
 
FONT does (occasionally) do something, but it's screwy. After this

1707757513461.png


I get this.

1707757687252.png


That is, indeed, Courier New, according to the properties dialog. If I try to go back with font /n"Consolas", nothing happens.
 
FONT is only for standalone console windows. For Take Command , use the TCFONT command.
Yes, that's what the documentation says, but it is not clear if this means that FONT is actually designed not to have an effect from Take Command, or if this simply means that the effect of changing the font in TCC would not be visible in Take Command.
In my case, the issue is not about how the characters look (Take Command keeps the Consolas font), but about the fact that some text is not displayed due to the font in the underlying TCC (that does not support UTF-8). It is not just some characters that are not displayed: whole lines become blank (with DIR), even whole files (with TYPE).
I digged around in the scripts of the compiler, it seems that the font changes after a call to PowerShell.
 
Yes, that's what the documentation says, but it is not clear if this means that FONT is actually designed not to have an effect from Take Command, or if this simply means that the effect of changing the font in TCC would not be visible in Take Command.
In my case, the issue is not about how the characters look (Take Command keeps the Consolas font), but about the fact that some text is not displayed due to the font in the underlying TCC (that does not support UTF-8). It is not just some characters that are not displayed: whole lines become blank (with DIR), even whole files (with TYPE).

Yes, if the underlying console uses raster fonts, the Unicode characters will get corrupted.

Try this: Detach the tab from Take Command, then close Take Command so you only have the console window open. Then press Alt-Space to open the control menu, then select Properties and choose the Font tab. Change the font to Consolas, then click on OK to close the Properties window, then EXIT to close the console. Restart Take Command and see whether that fixes your issue.
 
Yes, I have already tried such manipulations.
What I can do and it works: detach TCC, change the font of the TCC console, reattach the TCC console, and everything displays fine—but I have to do all this each time I open such a console, the change does not persist for the next console I open.
AFAIK Windows keeps the configuration of the console in Registry, based on the title of the console; I am quite sure that the title I see at the time I detach the console is not the title it has when it is created.
And anyway the change of the font seems to be the consequence of a script run under PowerShell: for now, I have commented out some lines in "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat", about line 239, @REM Send Telemetry if user's VS is opted-in, and the subsequent calls to PowerShell. Of course I don't like fiddling around in configuration scripts of the compiler, but this modification should not harm the compilation.
 
FONT is only for standalone console windows. For Take Command, use the TCFONT command.

That said... Yeah, FONT doesn't seem to be working for me either. I suspect this command is just a wrapper around SetCurrentConsoleFontEx(), which is a pretty flakey API even by Microsoft standards. Hopefully Rex will come up with a workaround.
FONT works pretty well when asked to change the size or weight but whenever you use /N (even with a garbage argument) you get Courier New.
 
Yes, I have already tried such manipulations.
What I can do and it works: detach TCC, change the font of the TCC console, reattach the TCC console, and everything displays fine—but I have to do all this each time I open such a console, the change does not persist for the next console I open.
AFAIK Windows keeps the configuration of the console in Registry, based on the title of the console; I am quite sure that the title I see at the time I detach the console is not the title it has when it is created.
And anyway the change of the font seems to be the consequence of a script run under PowerShell: for now, I have commented out some lines in "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat", about line 239, @REM Send Telemetry if user's VS is opted-in, and the subsequent calls to PowerShell. Of course I don't like fiddling around in configuration scripts of the compiler, but this modification should not harm the compilation.

Glad you found a solution that works for you.
 
And anyway the change of the font seems to be the consequence of a script run under PowerShell: for now, I have commented out some lines in "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat", about line 239, @REM Send Telemetry if user's VS is opted-in, and the subsequent calls to PowerShell. Of course I don't like fiddling around in configuration scripts of the compiler, but this modification should not harm the compilation.

As for modifying other people's scripts: I like to copy the original script to the same location, only with a .BTM extension. Leave the original .BAT unchanged and make my modifications to the .BTM. TCC will find the .BTM before the .BAT. CMD.EXE will ignore the .BTM and run the original.
 
AFAIK Windows keeps the configuration of the console in Registry, based on the title of the console; I am quite sure that the title I see at the time I detach the console is not the title it has when it is created.
I think it's the actual program rather than the title.

If you use REGEDIT to look here: HKEY_CURRENT_USER\Console

The values in that key are the defaults; the FaceName and Font* values seem to be the ones of interest. The defaults can be overridden by values in the various subkeys of HKEY_CURRENT_USER\Console. There's probably one or two subkeys for Powershell. I have a subkey named %SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe. Do they have such values? If so, does it explain anything? If you're happy with the defaults you could delete other app-specific values.
 
I think it's the actual program rather than the title. If you use REGEDIT to look here: HKEY_CURRENT_USER\Console
You are right, HKC\Console has keys for the program—I had never noticed or did not remember. I have also keys for the console window's title. I have 2 entries with …_powershell.exe, which had FaceName="Lucida Console" (not Raster); I changed these to "Consolas", but things don't work better. I think these keys configure the console at launch-time, I don't know if they apply to a powershell.exe that is launched in the middle of a script.
As for modifying other people's scripts: I like to copy the original script to the same location, only with a .BTM extension.
That's a good way to keep a trace. For me the issue is more that I can get new compilers installed, updates to the installed compilers, or even I can get a new computer (they are leased by the company and replaced regularly), and then I could have to start over tracking down such a font change.
 
FONT /N... is working as expected here.

Note that it will never work in a Take Command tab window, and it may or may not work in a stand-alone TCC window, depending on whether you're using the Legacy console option. Microsoft has dropped support for the API in the new consoles - they want you to use the escape sequences to change your console font.
 
Microsoft has dropped support for the API in the new consoles - they want you to use the escape sequences to change your console font.

I'm not aware of any sequences that will set the size or face of the console font. Can you give examples or a reference?
 
Legacy console option
I have already head about this (probably in this forum) but did never care. In french the label of the check box is translated as
1708435571124.png
= en:"Use the inherited console (requires restarting, affect all consoles)", which is misleading ("inherited" and "legacy" have completely different meanings in the context of software).
 
I have already head about this (probably in this forum) but did never care. In french the label of the check box is translated as
View attachment 4294 = en:"Use the inherited console (requires restarting, affect all consoles)", which is misleading ("inherited" and "legacy" have completely different meanings in the context of software).

That's Microsoft's dialog, not JP Software's.
 
Short answer is: Raster fonts are barely supported in legacy conhost and outright unsupported in modern TTY conhost. Don't use them, don't rely on them, forget they exist.

Given that, there's a selection of TTF fonts that you can use in console to a good effect.
 
That's not the theme here, the question was to switch fonts with FONT/N command, regardless if it's raster or TTF.

And then ...

FONT /N... is working as expected here

Note that it will never work in a Take Command tab window, and it may or may not work in a stand-alone TCC window, depending on whether you're using the Legacy console option. Microsoft has dropped support for the API in the new consoles - they want you to use the escape sequences to change your console font.

I'm not aware of any sequences that will set the size or face of the console font. Can you give examples or a reference?
 

Similar threads

Back
Top