WindowFontInfo
Script function

world.WindowFontInfo

DOC_scripting Read about scripting

Type

Method

Summary

Returns information about a font

Prototype

VARIANT WindowFontInfo(BSTR Name, BSTR FontId, long InfoType);

DOC_data_types 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.

Name - 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



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

DOC_miniwindows Mini Windows

Functions

FNC_GetDeviceCaps GetDeviceCaps (Gets screen device capabilities)
FNC_SetCursor SetCursor (Changes the shape of the mouse cursor)
FNC_TextRectangle TextRectangle (Specifies the size of the rectangle in which text is displayed in the output window.)
FNC_WindowAddHotspot WindowAddHotspot (Adds a hotspot to a miniwindow)
FNC_WindowArc WindowArc (Draws an arc in a miniwindow)
FNC_WindowBezier WindowBezier (Draws a Bézier curve in a miniwindow)
FNC_WindowBlendImage WindowBlendImage (Blends an image into a miniwindow, using a specified blending mode)
FNC_WindowCircleOp WindowCircleOp (Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow)
FNC_WindowCreate WindowCreate (Creates a miniwindow)
FNC_WindowCreateImage WindowCreateImage (Creates an image in a miniwindow)
FNC_WindowDelete WindowDelete (Deletes a miniwindow)
FNC_WindowDeleteAllHotspots WindowDeleteAllHotspots (Deletes all hotspots from a miniwindow)
FNC_WindowDeleteHotspot WindowDeleteHotspot (Deletes a hotspot from a miniwindow)
FNC_WindowDragHandler WindowDragHandler (Adds a drag handler to a miniwindow hotspot)
FNC_WindowDrawImage WindowDrawImage (Draws an image into a miniwindow)
FNC_WindowDrawImageAlpha WindowDrawImageAlpha (Draws an image into a miniwindow respecting the alpha channel)
FNC_WindowFilter WindowFilter (Performs a filtering operation over part of the miniwindow.)
FNC_WindowFont WindowFont (Loads a font into a miniwindow)
FNC_WindowFontList WindowFontList (Lists all fonts loaded into a miniwindow)
FNC_WindowGetPixel WindowGetPixel (Gets the colour of a single pixel in a miniwindow)
FNC_WindowGradient WindowGradient (Draws a gradient in a rectangle)
FNC_WindowHotspotInfo WindowHotspotInfo (Returns information about a hotspot)
FNC_WindowHotspotList WindowHotspotList (Lists all hotspots installed into a miniwindow)
FNC_WindowHotspotTooltip WindowHotspotTooltip (Changes the tooltip text for a hotspot in a miniwindow)
FNC_WindowImageFromWindow WindowImageFromWindow (Creates an image from another miniwindow)
FNC_WindowImageInfo WindowImageInfo (Returns information about an image)
FNC_WindowImageList WindowImageList (Lists all images installed into a miniwindow)
FNC_WindowImageOp WindowImageOp (Draws an ellipse, rectangle or round rectangle, filled with an image)
FNC_WindowInfo WindowInfo (Returns information about a miniwindow)
FNC_WindowLine WindowLine (Draws a line in a miniwindow)
FNC_WindowList WindowList (Lists all miniwindows)
FNC_WindowLoadImage WindowLoadImage (Loads an image into a miniwindow from a disk file)
FNC_WindowMenu WindowMenu (Creates a pop-up menu inside a miniwindow)
FNC_WindowMergeImageAlpha WindowMergeImageAlpha (Merges an image into a miniwindow based on an alpha mask)
FNC_WindowPolygon WindowPolygon (Draws a polygon in a miniwindow)
FNC_WindowPosition WindowPosition (Moves a miniwindow)
FNC_WindowRectOp WindowRectOp (Draws a rectangle in a miniwindow)
FNC_WindowSetPixel WindowSetPixel (Sets a single pixel in a miniwindow to the specified colour)
FNC_WindowShow WindowShow (Shows or hides a miniwindow)
FNC_WindowText WindowText (Draws text into a miniwindow)
FNC_WindowTextWidth WindowTextWidth (Calculates the width of text in a miniwindow)
FNC_WindowWrite WindowWrite (Writes the contents of a miniwindow to disk as a graphics file)

(Help topic: function=WindowFontInfo)

DOC_contents Documentation contents page