mIRC Homepage
Posted By: Epic $window().fontsize vs font dialog size - 13/11/20 02:40 PM
My client: mIRC v7.63. My system: Windows 8.1. I seem to have encountered an error while creating the script.

In "View/Font" me have the font installed "Comic Sans MS" with style "bold" and with size "11". But when I look at the properties of the active window, it shows me the font size as "15".

When setting the font "Comic Sans MS" with style "regular" and with size "10" property shows the font size as "13".

Code
//echo -a $window($active).font - $window($active).fontsize

This makes it difficult to get the exact font size in the active window to duplicate those sizes and settings in another window in my script. Maybe I'm doing something wrong.
Posted By: maroon Re: $window().fontsize vs font dialog size - 13/11/20 05:56 PM
Yes, this can be confusing. See https://forums.mirc.com/ubbthreads.php/topics/260579/bug-setting-getting-font-sizes-in-custom

The ratio between the 2 numbers is 4/3, but I'm not sure how fractions are handled.
Posted By: Epic Re: $window().fontsize vs font dialog size - 14/11/20 04:03 AM
I still don't understand how I can get the exact size of the font set to in "View/Font" or for the active window.

If the size is set to "11", then I need to get the value "11", not "15". Because (15 != 11) and because of this I will have a different font size whereas I need to duplicate the same value when creating a new window.

If can still somehow solve this problem in order to extract the exact font size, then please give an example in the form of code.
Posted By: Protopia Re: $window().fontsize vs font dialog size - 14/11/20 11:06 AM
Font sizes in mIRC appear to always be integer.

So the following will show the font size in points:

Code
//echo -a $window($active).font - $round($calc($window($active).fontsize * 3 / 4),0)
Posted By: Epic Re: $window().fontsize vs font dialog size - 14/11/20 11:23 AM
Thanks for the help! That helped. Although it would be much more convenient to extract the exact font size without such tricky calculations. But thanks anyway.
Posted By: Protopia Re: $window().fontsize vs font dialog size - 14/11/20 11:57 AM
You could ask Khaled to implement $window().fontpoints to give the font size in points.

I am assuming that the ratio between fontsize and points is always fixed at 3:4.
© mIRC Discussion Forums