Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ GetInfo for Font Size

GetInfo for Font Size

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Candido   USA  (78 posts)  Bio
Date Tue 05 Jan 2010 11:28 PM (UTC)
Message
Is there a GetInfo for the current output font size? I've looked at the list and I see the GetInfo's for width and height, but I'm referring to the size that you choose in the output settings.

In other words, I want to do this:

WindowFont("window", "standard", GetInfo(20), (font size function would go here), false, false, false, false, 1, 0)

Which would give the miniwindow the same font as the output window. If not, an alternative method would also be good if anyone knows one.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Tue 05 Jan 2010 11:33 PM (UTC)

Amended on Tue 05 Jan 2010 11:46 PM (UTC) by Twisol

Message
I asked a similar question recently, and the equation Nick gave should work well for you, I think.
Template:post=9878 Please see the forum thread: http://gammon.com.au/forum/?id=9878.


Basically, you'd probably want to do this:

function output_font_size()
  return math.floor((0.5 + GetInfo(212)) * 72 / GetDeviceCaps(90))
end


EDIT: Oddly, this returns 12 for me, when my output font is Dina 10pt. Maybe I messed something up in translation.

EDIT 2: And if I change my font to 9pt or 8pt Dina, the value returned is 11 or 10. Yet if I change to, say, 10pt Dotum (next down on my font list), it returns 10 as expected. I think we must be missing a factor in the formula.

EDIT 3: Alternatively, could we maybe just have additional GetInfo() and WindowFontInfo() selectors for the font's size? *laughs*

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #2 on Wed 06 Jan 2010 02:36 AM (UTC)
Message
Why be so difficult?

Note("My output font is "..GetOption("output_font_height").."pt tall.")


Should do wonders.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #3 on Wed 06 Jan 2010 02:38 AM (UTC)
Message
Well.... That's handy.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #4 on Wed 06 Jan 2010 02:59 AM (UTC)
Message
You can get basically every persistent world-specific setting through GetOption() and GetAlphaOption(). So basically everything in world configuration, but also some settings Nick implemented that don't have interface settings to toggle them (which you'd do with the Set* varieties).

Just open a world file in notepad, and look through it for the specific string you need. Sometimes they're a bit awkwardly named or hard to find, and yet in other times they're missing alltogether - in which case you need to temporarily change the option and save your world file so you can see it after all as MUSHclient only saves non-default settings by default.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 06 Jan 2010 03:34 AM (UTC)
Message
Twisol said:


EDIT: Oddly, this returns 12 for me, when my output font is Dina 10pt. Maybe I messed something up in translation.



I think your problem is here, from the page you quoted:

Nick Gammon said:

According to the Microsoft knowledge base article, the character height, which is what we want, is the font height minus the internal leading. So we need to take WindowFontInfo (win, "f", 1) and subtract WindowFontInfo (win, "f", 4) .


You have used the font height (effectively selector 1) without subtracting the leading (selector 4). Thus this method won't work for the world fonts, however as Worstje says, you don't need to bother anyway.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Candido   USA  (78 posts)  Bio
Date Reply #6 on Wed 06 Jan 2010 05:49 AM (UTC)
Message
Perfect, thanks.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


25,048 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.