mIRC Homepage

Bug setting/getting font sizes in @custom

Posted By: maroon

Bug setting/getting font sizes in @custom - 16/05/17 07:03 PM

Seems to happen regardless of the font. I chose Consolas to avoid the need for "quotes" around the fontname, and also because it has a wide variety of listed sizes compared to Courier.

1. Go to Notepad and use /edit/font to set Font to Consolas and Size to 14, then put any text in the window so you have a reference for how large Consolas 14 text should appear.

2. Create window: //window -c @test | window -e @test Consolas 14

3. Take a peek at @test window's upper-left system menu to see that it reports font size as 11 not the 14 you used to create the window. Use @test's editbox to paste: //echo -a $window($active) $window($active).font $window($active).fontsize

@test Consolas 14

... and you see it reports the size as the 14, though the text is much smaller than it appears in Notepad. Change Notepad's fontsize to 11, and you'll see Notepad's text shrinking to the size the text displays in @test.

4. Go back to @test's system menu and keep the fontname the same, but change the size to any other size, and repeat the echo in Step#3 above. mIRC changes echo'ed size number to always be a number somewhere 27-33% larger than the number you set in the font menu.

It appears that mIRC displays text the size as shown in @test's system menu, which is smaller than the incorrect size reported by $window(@test).fontsize, and is smaller than the size used to create the window. This also means that if I want to make @test display text as Consolas 14, I need to first go into @test or any other window and set the size to 14, then discover that .fontsize reports the size as 19. Then I can create the window by telling it to use size 19, causing it to report in the system menu that the font is 14, and displays text the same size that notepad displays when it uses size 14.

I see this same thing happening in mIRC 7.48 and 6.35. I hadn't gone into Windows 7's Control-Panel/Display and set display away from the default 100%, so this isn't a case of trying to adjust to a control panel setting of 125%.
Posted By: Khaled

Re: Bug setting/getting font sizes in @custom - 18/05/17 08:56 AM

Thanks for your bug report. This is due to how font support was originally added to the scripting language. The Windows API supports positive (cell height) and negative (character height) font sizes. The scripting commands use cell height, whereas the font dialog uses character height. To use character height in scripting comands, you need to specify a negative value. In your example, a value of -11 will match 11 in the font dialog. This is currently described in the /font command entry in the help file.
© 2022 mIRC Discussion Forums