Skip to main content
Version: 8.1

toFont

This function is used by Ignition's Expression language..

Description​

Coerces a string into a font. The string must be in the format:

'(fontName, fontType, fontSize)'

fontName is the name of the font to use. Note that special care must be taken with fonts, because of the web-launched nature of the clients. You can only use font names that exist on the client machines. The following font names are known as logical fonts, meaning that they are guaranteed to exist on all systems, mapped to the most appropriate real, or physical font that exists on the host system:

  • Serif
  • SansSerif
  • Monospaced
  • Dialog
  • DialogInput

fontType is a string that should match one of these (case-insensitive):

  • Plain
  • Bold
  • Italic
  • BoldItalic

fontSize is an integer that represents the font's point size.

Syntax​

toFont(value, [failover])

  • Parameters

    • String value - The value to type cast to a font.

    • Object failover - The failover value if type casting fails. [optional]

  • Results

    • Font - The value type cast as a font.

Examples​

Code Snippet
toFont("font(Dialog,Bold,12)") //returns the standard font used in most clients.