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

MUSHclient scripting

Description of MUSHclient world function: world.WindowFontInfo

Name WindowFontInfo
Type Method
Summary Returns information about a font
Prototype VARIANT WindowFontInfo(BSTR WindowName, BSTR FontId, long InfoType);

View list of data type meanings


This returns information about a loaded font. You need to specify the name of the miniwindow, and the font id you used when loading the font.

Probably the most important item is number 1 - the height of the font. If you are drawing multiple lines of a particular font, you should add the font height to the "y" parameter of the rectangle, to move the pixel position down the window an appropriate amount.

WindowName - the name of an existing miniwindow.

FontId - the font id you used when you loaded the font.

InfoType - the information you want:

1: Height - Specifies the height (ascent + descent) of characters.

2: Ascent - Specifies the ascent (units above the base line) of characters

3: Descent - Specifies the descent (units below the base line) of characters.

4: Internal Leading - Specifies the amount of leading (space) inside the bounds set by the height. Accent marks and other diacritical characters may occur in this area. The designer may set this to zero.

5: External Leading - Specifies the amount of extra leading (space) that the application adds between rows. Since this area is outside the font, it contains no marks and is not altered by text output calls. The designer may set this member to zero.

6: Average Character Width - Specifies the average width of characters in the font (generally defined as the width of the letter x). This value does not include the overhang required for bold or italic characters.

7: Maximum Character Width - Specifies the width of the widest character in the font.

8: Weight - Specifies the weight of the font.

9: Overhang - Specifies the extra width per string that may be added to some synthesized fonts. When synthesizing some attributes, such as bold or italic, graphics device interface (GDI) or a device may have to add width to a string on both a per-character and per-string basis. For example, GDI makes a string bold by expanding the spacing of each character and overstriking by an offset value; it italicizes a font by shearing the string. In either case, there is an overhang past the basic string. For bold strings, the overhang is the distance by which the overstrike is offset. For italic strings, the overhang is the amount the top of the font is sheared past the bottom of the font.

10: Digitized Aspect X - Specifies the horizontal aspect of the device for which the font was designed.

11: Digitized Aspect Y - Specifies the vertical aspect of the device for which the font was designed. The ratio of the DigitizedAspectX and DigitizedAspectY is the aspect ratio of the device for which the font was designed.

12: First Character - Specifies the value of the first character defined in the font.

13: Last Character - Specifies the value of the last character defined in the font

14: Default Character - Specifies the value of the character to be substituted for characters not in the font.

15: Break Character - Specifies the value of the character that will be used to define word breaks for text justification.

16: Italic - Specifies an italic font if it is nonzero.

17: Underlined - Specifies an underlined font if it is nonzero.

18: Struck Out - Specifies a strikeout font if it is nonzero.

19: Pitch And Family - Specifies information about the pitch, the technology, and the family of a physical font.

20: Character Set - Specifies the character set of the font.

21: Name - Specifies the name of the font

For more information, see:


Note: Available in version 4.34 onwards.

Lua example
WindowFontInfo (win, "f", 1)  --> get text height
Lua notes
Lua returns nil instead of a NULL or EMPTY variant.
Returns The specified information about the font, as described above.
An EMPTY variant, if the font does not exist.
A NULL variant if the InfoType is not a valid type.
Introduced in version 4.34

See also ...

Function Description
WindowCreate Creates a miniwindow
WindowFont Loads a font into a miniwindow
WindowFontList Lists all fonts loaded into a miniwindow
WindowText Draws text into a miniwindow
WindowTextWidth Calculates the width of text in a miniwindow

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.

Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes

Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes

View all functions


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.


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]