Using FontAwesome in LiveCode
Posted: Thu Jul 02, 2015 8:29 pm
A question came up in the Create It webinar about how to use the FontAwesome glyph font (icon font) in LiveCode. Assuming you have the font loaded on your system, here's one method you can use for LC7 and later:
1) Locate the icon you need using any of the "cheat sheets" available online, such as this one:
http://fortawesome.github.io/Font-Awesome/cheatsheet/
Make note of the Unicode string associated with the icon character. For example, the Apple icon is 
2) Tweek the Unicode string by changing the first 2 characters &# to 0 (zero) and removing the trailing semicolon, so the string reads as 0xf179.
3) Set the textFont of the control (ie a button or field) where you intend to display the icon to "FontAwesome". Then, in the case of a button, set the label property of the button using the numToCodepoint function. Example:
In LiveCode 6 and earlier, you first need to enable the useUnicode property before applying Unicode text, and then (using a button as an example) set the unicodeLabel property of the button using the numToChar function.
Hope this helps.
1) Locate the icon you need using any of the "cheat sheets" available online, such as this one:
http://fortawesome.github.io/Font-Awesome/cheatsheet/
Make note of the Unicode string associated with the icon character. For example, the Apple icon is 
2) Tweek the Unicode string by changing the first 2 characters &# to 0 (zero) and removing the trailing semicolon, so the string reads as 0xf179.
3) Set the textFont of the control (ie a button or field) where you intend to display the icon to "FontAwesome". Then, in the case of a button, set the label property of the button using the numToCodepoint function. Example:
Code: Select all
set the label of button 1 to numToCodepoint("0xf179")
Code: Select all
set the useUnicode to true
set the unicodeLabel of btn 1 to numToChar("0xf179")