Welcome!

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

SignUp Now!

How does FONT work?

May
12,846
164
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
 
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 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.
 
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
 
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...
 
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.
 
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?
 
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.
 
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.
 
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.
 
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).
 
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

Back
Top