Returns the glyph index of a glyph (character) in a font
This lets you test if a particular glyph can be rendered in the specified font. This lets a script writer see if a suitable Unicode font has been installed when using UTF-8 mode.
Zero will be returned if the glyph is not in the font. Nil will be returned if the gdi32 DLL cannot be loaded or if the function GetGlyphIndicesW is not available from Windows.
The number 31 might be returned which probably indicates that the glyph is not in that font.
Other numbers (other than nil, 0 or 31) would indicate that the glyph is available. The exact number represents the "glyph index" in the font table.
Note that it appears that even if 0 is returned that character might be rendered anyway because Windows uses a "fallback" font if a character is not available in the main font. However whether or not this works seems to depend on what main font is selected (for example, if it is a Unicode font or not).
The intention of this function is to let script (plugin) writers warn users if they are planning to use certain glyphs (for example, mapping symbols) which are not in the currently-selected font.
See Also ...
utils.activatenotepad - Actvitates the specified notepad window
Lua base functions
(Help topic: lua=utils.glyph_available)
Enter a search string to find matching documentation.
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )