mIRC Homepage

/font bug and $window().font

Posted By: klez

/font bug and $window().font - 21/02/18 11:47 AM

Deducting after the /font command, in the next example:

Code:
/font Status Window 13 Calibri


the active window meets an unknown font (for me) and if execute //echo -a $window($active).font (where the previous command was executed from) then it returns: Window 13 Calibri that is nonsence!

I know that the command for status must be /font -s 13 Calibri, but let's do another example:

Code:
/font Status test 13 Calibri


When executing it on Status Window the $window($active).font returns test 13 Calibri, however $window($active).fontsize returns 12, $window($active).fontbold and $window($active).fontitalic return $false; $window($active).fontcs returns 1.

The same is for other windows also if it used instead of "Status" the name of the window.

I think the /font command must be restricted to be used in inappropriate syntax.
Posted By: Khaled

Re: /font bug and $window().font - 21/02/18 12:37 PM

Thanks for your bug report. As far as I can tell, the behaviour is valid. There are several reasons for this. First, both the window name and the font size are optional. Second, /font only supports one word for the window name, which is why it has -s for the status window.

Since you specified the window name as "status window" (with or without quotes), /font sees the window name as "status", which does not currently exist, although it might be a valid window name that might be opened later on, so it uses it. It then checks for a fontsize, which it sees as "Window", which is not a number so it ignores it and uses a default font size. So the font name then becomes "Window 13 Calibri". For a number of reasons, /font does not check whether you have specified an existing font name, it simply passes the font name to Windows and Windows chooses the most appropriate font.

For your example, you would simply need to use /font -s 13 Calibri.

Unfortunately, there is so much going on in the /font command routine, that has built up over the last twenty years, that even a small change would break backwards compatiblity.
© 2021 mIRC Discussion Forums