mIRC Home    About    Download    Register    News    Help

Print Thread
$window().fontsize vs font dialog size #268083 13/11/20 02:40 PM
Joined: Jan 2012
Posts: 62
Epic Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2012
Posts: 62
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.

Re: $window().fontsize vs font dialog size [Re: Epic] #268084 13/11/20 05:56 PM
Joined: Jan 2004
Posts: 1,437
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,437
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.

Re: $window().fontsize vs font dialog size [Re: maroon] #268087 14/11/20 04:03 AM
Joined: Jan 2012
Posts: 62
Epic Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2012
Posts: 62
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.

Re: $window().fontsize vs font dialog size [Re: Epic] #268088 14/11/20 11:06 AM
Joined: Aug 2003
Posts: 284
P
Protopia Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 284
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)

Re: $window().fontsize vs font dialog size [Re: Protopia] #268089 14/11/20 11:23 AM
Joined: Jan 2012
Posts: 62
Epic Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2012
Posts: 62
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.

Re: $window().fontsize vs font dialog size [Re: Epic] #268090 14/11/20 11:57 AM
Joined: Aug 2003
Posts: 284
P
Protopia Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 284
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.