Script function
world.WindowFontInfo
Read about scripting
Type
Method
Summary
Returns information about a font
Prototype
VARIANT WindowFontInfo(BSTR WindowName, BSTR FontId, long InfoType);
View list of data type meanings
Description
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:
http://www.gammon.com.au/mushclient/mw_text.htm
Available in MUSHclient 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.
Return value
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.
See Also ...
Topic
MiniWindows
Functions
(GetDeviceCaps) Gets screen device capabilities
(SetCursor) Changes the shape of the mouse cursor
(TextRectangle) Specifies the size of the rectangle in which text is displayed in the output window.
(WindowAddHotspot) Adds a hotspot to a miniwindow
(WindowArc) Draws an arc in a miniwindow
(WindowBezier) Draws a Bézier curve in a miniwindow
(WindowBlendImage) Blends an image into a miniwindow, using a specified blending mode
(WindowCircleOp) Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow
(WindowCreate) Creates a miniwindow
(WindowCreateImage) Creates an image in a miniwindow
(WindowDelete) Deletes a miniwindow
(WindowDeleteAllHotspots) Deletes all hotspots from a miniwindow
(WindowDeleteHotspot) Deletes a hotspot from a miniwindow
(WindowDragHandler) Adds a drag handler to a miniwindow hotspot
(WindowDrawImage) Draws an image into a miniwindow
(WindowDrawImageAlpha) Draws an image into a miniwindow respecting the alpha channel
(WindowFilter) Performs a filtering operation over part of the miniwindow.
(WindowFont) Loads a font into a miniwindow
(WindowFontList) Lists all fonts loaded into a miniwindow
(WindowGetImageAlpha) Draws the alpha channel of an image into a miniwindow
(WindowGetPixel) Gets the colour of a single pixel in a miniwindow
(WindowGradient) Draws a gradient in a rectangle
(WindowHotspotInfo) Returns information about a hotspot
(WindowHotspotList) Lists all hotspots installed into a miniwindow
(WindowHotspotTooltip) Changes the tooltip text for a hotspot in a miniwindow
(WindowImageFromWindow) Creates an image from another miniwindow
(WindowImageInfo) Returns information about an image
(WindowImageList) Lists all images installed into a miniwindow
(WindowImageOp) Draws an ellipse, rectangle or round rectangle, filled with an image
(WindowInfo) Returns information about a miniwindow
(WindowLine) Draws a line in a miniwindow
(WindowList) Lists all miniwindows
(WindowLoadImage) Loads an image into a miniwindow from a disk file
(WindowMenu) Creates a pop-up menu inside a miniwindow
(WindowMergeImageAlpha) Merges an image into a miniwindow based on an alpha mask
(WindowMoveHotspot) Moves a hotspot in a miniwindow
(WindowPolygon) Draws a polygon in a miniwindow
(WindowPosition) Moves a miniwindow
(WindowRectOp) Draws a rectangle in a miniwindow
(WindowResize) Resizes a miniwindow
(WindowScrollwheelHandler) Adds a scroll-wheel handler to a miniwindow hotspot
(WindowSetPixel) Sets a single pixel in a miniwindow to the specified colour
(WindowSetZOrder) Sets the Z-Order for a miniwindow
(WindowShow) Shows or hides a miniwindow
(WindowText) Draws text into a miniwindow
(WindowTextWidth) Calculates the width of text in a miniwindow
(WindowTransformImage) Draws an image into a miniwindow with optional rotation, scaling, reflection and shearing
(WindowWrite) Writes the contents of a miniwindow to disk as a graphics file
(Help topic: function=WindowFontInfo)