How does FONT work?

May 20, 2008
11,411
99
Syracuse, NY, USA
I used all possible combinations of x and y (i=1 to 16, j=1 to 18) and noted the font actually obtained by "FONT /Xi /Yj". The complete list is (far) below. It doesn't make much sense to me. Nowhere in it are 4x6, 6x8, or 5x12. And what you actually get depends on what the font is! For example, the first time 8x12 was achieved below was with i=1 and j=17. When the test (far below) was done, specifying 1,17 did nothing at all!
Code:
v:\> echo %_fontw x %_fonth
10 x 18
 
v:\> font /x1 /y17
 
v:\> echo %_fontw x %_fonth
10 x 18

Is there any rhyme or reason to it at all?

Code:
v:\> do i=1 to 16 ( do j=1 to 18  ( font /x%i /y%j & delay /m 500 & echo %i,%j^t%_fontw x %_fonth ) )
1,1    16 x 8
1,2    16 x 8
1,3    16 x 8
1,4    16 x 8
1,5    16 x 8
1,6    16 x 8
1,7    16 x 8
1,8    16 x 8
1,9    16 x 12
1,10    16 x 12
1,11    16 x 12
1,12    16 x 12
1,13    8 x 12
1,14    12 x 16
1,15    12 x 16
1,16    12 x 16
1,17    8 x 12
1,18    10 x 18
2,1    16 x 8
2,2    16 x 8
2,3    16 x 8
2,4    16 x 8
2,5    16 x 8
2,6    16 x 8
2,7    16 x 8
2,8    16 x 8
2,9    16 x 12
2,10    16 x 12
2,11    16 x 12
2,12    16 x 12
2,13    8 x 12
2,14    12 x 16
2,15    12 x 16
2,16    12 x 16
2,17    8 x 12
2,18    10 x 18
3,1    16 x 8
3,2    16 x 8
3,3    16 x 8
3,4    16 x 8
3,5    16 x 8
3,6    16 x 8
3,7    16 x 8
3,8    16 x 8
3,9    16 x 12
3,10    16 x 12
3,11    16 x 12
3,12    16 x 12
3,13    8 x 12
3,14    12 x 16
3,15    12 x 16
3,16    12 x 16
3,17    8 x 12
3,18    10 x 18
4,1    16 x 8
4,2    16 x 8
4,3    16 x 8
4,4    16 x 8
4,5    16 x 8
4,6    16 x 8
4,7    16 x 8
4,8    16 x 8
4,9    16 x 12
4,10    16 x 12
4,11    16 x 12
4,12    16 x 12
4,13    8 x 12
4,14    12 x 16
4,15    12 x 16
4,16    12 x 16
4,17    8 x 12
4,18    10 x 18
5,1    16 x 8
5,2    16 x 8
5,3    16 x 8
5,4    16 x 8
5,5    16 x 8
5,6    16 x 8
5,7    16 x 8
5,8    16 x 8
5,9    16 x 12
5,10    16 x 12
5,11    16 x 12
5,12    16 x 12
5,13    8 x 12
5,14    12 x 16
5,15    12 x 16
5,16    12 x 16
5,17    8 x 12
5,18    10 x 18
6,1    16 x 8
6,2    16 x 8
6,3    16 x 8
6,4    16 x 8
6,5    16 x 8
6,6    16 x 8
6,7    16 x 8
6,8    16 x 8
6,9    16 x 12
6,10    16 x 12
6,11    16 x 12
6,12    16 x 12
6,13    8 x 12
6,14    12 x 16
6,15    12 x 16
6,16    12 x 16
6,17    8 x 12
6,18    10 x 18
7,1    16 x 8
7,2    16 x 8
7,3    16 x 8
7,4    16 x 8
7,5    16 x 8
7,6    16 x 8
7,7    16 x 8
7,8    16 x 8
7,9    16 x 12
7,10    16 x 12
7,11    16 x 12
7,12    16 x 12
7,13    8 x 12
7,14    12 x 16
7,15    12 x 16
7,16    12 x 16
7,17    8 x 12
7,18    10 x 18
8,1    16 x 8
8,2    16 x 8
8,3    16 x 8
8,4    16 x 8
8,5    16 x 8
8,6    16 x 8
8,7    16 x 8
8,8    16 x 8
8,9    16 x 12
8,10    16 x 12
8,11    16 x 12
8,12    16 x 12
8,13    8 x 12
8,14    12 x 16
8,15    12 x 16
8,16    12 x 16
8,17    8 x 12
8,18    10 x 18
9,1    16 x 8
9,2    16 x 8
9,3    16 x 8
9,4    16 x 8
9,5    16 x 8
9,6    16 x 8
9,7    16 x 8
9,8    16 x 8
9,9    16 x 12
9,10    16 x 12
9,11    16 x 12
9,12    16 x 12
9,13    8 x 12
9,14    12 x 16
9,15    12 x 16
9,16    12 x 16
9,17    8 x 12
9,18    10 x 18
10,1    16 x 8
10,2    16 x 8
10,3    16 x 8
10,4    16 x 8
10,5    16 x 8
10,6    16 x 8
10,7    16 x 8
10,8    16 x 8
10,9    16 x 12
10,10  16 x 12
10,11  16 x 12
10,12  16 x 12
10,13  8 x 12
10,14  12 x 16
10,15  12 x 16
10,16  12 x 16
10,17  8 x 12
10,18  10 x 18
11,1    16 x 8
11,2    16 x 8
11,3    16 x 8
11,4    16 x 8
11,5    16 x 8
11,6    16 x 8
11,7    16 x 8
11,8    16 x 8
11,9    16 x 12
11,10  16 x 12
11,11  16 x 12
11,12  16 x 12
11,13  8 x 12
11,14  12 x 16
11,15  12 x 16
11,16  12 x 16
11,17  8 x 12
11,18  10 x 18
12,1    16 x 8
12,2    16 x 8
12,3    16 x 8
12,4    16 x 8
12,5    16 x 8
12,6    16 x 8
12,7    16 x 8
12,8    16 x 8
12,9    16 x 12
12,10  16 x 12
12,11  16 x 12
12,12  16 x 12
12,13  8 x 12
12,14  12 x 16
12,15  12 x 16
12,16  12 x 16
12,17  8 x 12
12,18  10 x 18
13,1    16 x 8
13,2    16 x 8
13,3    16 x 8
13,4    16 x 8
13,5    16 x 8
13,6    16 x 8
13,7    16 x 8
13,8    16 x 8
13,9    16 x 12
13,10  16 x 12
13,11  16 x 12
13,12  16 x 12
13,13  8 x 12
13,14  12 x 16
13,15  12 x 16
13,16  12 x 16
13,17  8 x 12
13,18  10 x 18
14,1    16 x 8
14,2    16 x 8
14,3    16 x 8
14,4    16 x 8
14,5    16 x 8
14,6    16 x 8
14,7    16 x 8
14,8    16 x 8
14,9    16 x 12
14,10  16 x 12
14,11  16 x 12
14,12  16 x 12
14,13  8 x 12
14,14  12 x 16
14,15  12 x 16
14,16  12 x 16
14,17  8 x 12
14,18  10 x 18
15,1    16 x 8
15,2    16 x 8
15,3    16 x 8
15,4    16 x 8
15,5    16 x 8
15,6    16 x 8
15,7    16 x 8
15,8    16 x 8
15,9    16 x 12
15,10  16 x 12
15,11  16 x 12
15,12  16 x 12
15,13  8 x 12
15,14  12 x 16
15,15  12 x 16
15,16  12 x 16
15,17  8 x 12
15,18  10 x 18
16,1    16 x 8
16,2    16 x 8
16,3    16 x 8
16,4    16 x 8
16,5    16 x 8
16,6    16 x 8
16,7    16 x 8
16,8    16 x 8
16,9    16 x 12
16,10  16 x 12
16,11  16 x 12
16,12  16 x 12
16,13  8 x 12
16,14  12 x 16
16,15  12 x 16
16,16  12 x 16
16,17  8 x 12
16,18  10 x 18
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
FONT calls the Windows SetCurrentConsoleFontEx API. 99% of your input is invalid, but instead of returning an error SetCurrentConsoleFontEx is converting it to something it thinks is appropriate. How it decides that is an undocumented mystery.

However, there is also a typo in the current build that sometimes affects the resulting font width. It's been corrected for the next build.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I analyzed your table, and I found that X is ignored, Y alone controls size as follows (at least on your platform):

x y size
any 1- 8 16 x 8
any 9-12 16 x 12
any 13 8 x 12
any 14-16 12 x 16
any 17 8 x 12
any 18 10 x 18

Rex:

Is it feasible to enhance the FONT command in the future to act similarly to many other commands, e.g., ALIAS, to display the properties of the current font when no option is specified? Not having used TCMD on a platform which supports it the idea never arose.

Would it be feasible for commands that are not available on a given platform (e.g. FONT) to give a "not available" message? Likewise, options/internal variables/functions? The message would be displayed only if there is an actual attempt to use the non-available feature, so that batch files (aliases, etc.) that bypass the feature on earlier platforms would not make a report.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Sorry, I used spaces to columnarize the table - apparently without the
Code:
 tag whitespace is compressed by Xenforo software... Trying again:
[code]
  x       y      size
any    1- 8    16 x  8
any    9-12    16 x 12
any      13     8 x 12
any   14-16    12 x 16
any      17     8 x 12
any      18    10 x 18
 
May 20, 2008
3,515
4
Elkridge, MD, USA
The space compression was not performedbut I forgot not to use the "code" tag literally in the text. Don't know how one can "quote" a tag so it could be included in a message body without being interpreted...
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
I analyzed your table, and I found that X is ignored, Y alone controls size as follows (at least on your platform):

See my previous message.

Is it feasible to enhance the FONT command in the future to act similarly to many other commands, e.g., ALIAS, to display the properties of the current font when no option is specified?

You can add that to the suggestions list.

Would it be feasible for commands that are not available on a given platform (e.g. FONT) to give a "not available" message?

They already do.

Likewise, options/internal variables/functions?

There's a grand total of 1 internal variable or function that falls into that category (@HANDLEINFO); it returns an empty string if it's not supported. Changing that would break existing functionality & batch files while providing no benefit.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
FONT calls the Windows SetCurrentConsoleFontEx API. 99% of your input is invalid, but instead of returning an error SetCurrentConsoleFontEx is converting it to something it thinks is appropriate. How it decides that is an undocumented mystery.

However, there is also a typo in the current build that sometimes affects the resulting font width. It's been corrected for the next build.
I can't find SetConsoleFontEx in any VS2010 headers. Do you have it in VS1012 or do you dig it out of a DLL?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Somehow my response to Rex failed to be posted. My analysis was entered in the thread on my computer and uploaded before Xenforo displayed Rex' error report, else it would not have been made. As to the 2nd item, commands not valid on current platform, I tried FONT without parameters on WinXP, and received parsing error message, which seems to have priority over the "not available on current platform" message. It's a judgment call which has priority, but IMHO the unavailability message should have priority, so the user does not waste time fixing the command parameters before discovering the command is not available. On the last issue, whatever restrictions on usage are prominently documented is acceptable, with the caveat that there be a difference between "feature not available on current platform" and any other result. I would consider not only commands and command options, but also variable functions, internal variables, initialization directives, and conditional expressions (esp. status tests) in the category that may be OS version restricted, i.e., work in a specific build of TCC only when it is run on Windows platforms not older than specified for the feature.
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
I would consider not only commands and command options, but also variable functions, internal variables, initialization directives, and conditional expressions (esp. status tests) in the category that may be OS version restricted, i.e., work in a specific build of TCC only when it is run on Windows platforms not older than specified for the feature.

There are only three version restricted commands, all documented. There are no internal variables, no variable functions, and one initialization directive (also documented). I don't know what you're referring to with "conditional expressions" -- do you mean IF tests? There are none of those.

I certainly hope that people aren't writing code using commands when they haven't even looked at the help for that command!

IMO you're arguing to fix a nonexistent problem.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
There are only three version restricted commands, all documented. There are no internal variables, no variable functions, and one initialization directive (also documented). I don't know what you're referring to with "conditional expressions" -- do you mean IF tests? There are none of those.
By "conditional expressions" I mean the status tests available in IF (and in IFF, DO WHILE, DO UNTIL). As for what features are restricted to later OS versions, it is my prediction that in future versions of TCC there may be more of them, and they may be of types that currently don't have them.

I certainly hope that people aren't writing code using commands when they haven't even looked at the help for that command!
Of course I agree!

IMO you're arguing to fix a nonexistent problem.
It's not a problem, it's an issue of convenience. If the restriction is prominently displayed on the title bar of the page, as is done already for features not available in LE, one would not bother to read the details of what a command would do on another system - as is the case with FONT. MKLINK is different - not all options are OS version restricted. A notice "OS version restrictions apply" in the title bar of its HELP page and highlighting the restriction's description would make it readable more quickly.
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
By "conditional expressions" I mean the status tests available in IF (and in IFF, DO WHILE, DO UNTIL). As for what features are restricted to later OS versions, it is my prediction that in future versions of TCC there may be more of them, and they may be of types that currently don't have them.

My prediction is that future versions of TCC still won't have any, as I'll be dropping XP support (which is the cannonball shackled to my ankle).
 
Feb 23, 2012
240
3
I

That's what the article says, but is it really in WinCon.h? ... it's not in mine!

It's in mine, dated Sept 2009:

Code:
#ifndef NOGDI
WINBASEAPI
BOOL
WINAPI
GetCurrentConsoleFontEx(
    __in HANDLE hConsoleOutput,
    __in BOOL bMaximumWindow,
    __out PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);

WINBASEAPI
BOOL
WINAPI
SetCurrentConsoleFontEx(
    __in HANDLE hConsoleOutput,
    __in BOOL bMaximumWindow,
    __in PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
#endif
 
Similar threads
Thread starter Title Forum Replies Date
D Parsing an array variable to an array does not work Support 5
J Take command does not start on Windows 10 Support 3
J ffind does not find files Support 4
Joe Caverly PAUSE does not erase countdown timer Support 0
D ParentDirectory does not update directory history Support 6
D Documentation Help "Startup" page does not describe global lists Support 0
Charles Dye Does HASH's /E option do anything? Support 1
fishman@panix.com First TCC instantiation after reboot does not work. Support 17
D Fixed @VERSION does not increment pre-fixed version numbers. Support 1
vefatica Why does @WSLPATH double the leading '/'? Support 7
D What does the file "..\Everything\Run history.csv" store? Support 5
Peter Murschall WAD rem does not work correctly Support 8
vefatica Does @SYMLINK work? Support 6
R Tree on FAT32 does not sort by name by default. Support 6
A Tcc does not recognize "bcdedit" Support 20
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
M Ctrl-C when using command line history does nothing Support 2
vefatica JOBS /K ... how does it work? Support 5
Joe Caverly Why does TCCRT return VIEW as an internal command? Support 6
D Does TCC improve CMD's implementation of ECHO? Support 6
vefatica Find Files/Text dialog: does it work? Support 0
Alpengreis [v22.00.41] sync command flag "/X" does not work Support 22
Joe Caverly .PS1 script does not work with PSHELL Support 11
M MOVE does not behaves like intended (on failure) Support 1
R Fixed Sendmail parameter /USER= does not work Support 4
twaterloo does tcc have a task sceduler Support 4
Brian Woodward How to? Does FTP.CFG only support SSL over port 21? (Newbie) Support 6
M Activation Key does not correspond… Support 2
James Miller tcc shell window does not disappear Support 18
D Lua does not work on the commandline Support 5
D Fresh instance of TCMD does not use TCMD.INI Support 7
D Fixed @Lua does not behave as documented Support 8
D everything /o does not open the option dialog Support 4
M Why does HELP keep opening in the background? Support 0
vefatica Does TCC know I'm visiting the forums? Support 76
vefatica Why does my forum theme keep changing? Support 1
fishman@panix.com 19.02.37 Does Not Install For Me Support 2
I Windows 10 console does not allow alt-F4 alias to complete Support 1
fromano WAD ver /r does not detect Win 10B10166 Support 5
Alpengreis Fixed BATCOMP /O does not work Support 1
D Fixed Cut and paste in TC's file/folder view does not remove file Support 17
E View (internal command) does nothing now Support 3
D How does Cut work? Support 8
B How to? why does my BTM stop Support 2
I "IF" command in a variable does not expand redirection variable name Support 0
samintz How to? What does ~ do? Support 1
C Msg Popup window does not close Support 8
D WAD Alt-Left doesn't work, but Alt-Shift-Left does Support 1
Joe Caverly @SCRIPT does not like all comments Support 2
R WAD Copy /w does not use recycle bin Support 7

Similar threads