[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  GetInfo for Font Size
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

GetInfo for Font Size

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


Posted by Candido   USA  (78 posts)  [Biography] 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.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[Go to top] top

Posted by Candido   USA  (78 posts)  [Biography] bio
Date Reply #6 on Wed 06 Jan 2010 05:49 AM (UTC)
Message
Perfect, thanks.
[Go to top] 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.


5,464 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]