Description of MUSHclient world function: world.WindowFontInfo
||Returns information about a font
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.
WindowFontInfo (win, "f", 1) --> get text height
Lua returns nil instead of a NULL or EMPTY variant.
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
See also ...
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.
Leave blank to show all functions.
Many functions return a "code" which indicates the success or otherwise
of the function.
view a list of the return codes
The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).
view a list of the data types used in function prototypes
View all functions
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )