Tulip  5.2.1
Large graphs analysis and drawing
tlp::TulipFontAwesome Class Reference

#include <TulipFontAwesome.h>

Static Public Member Functions

static unsigned int getIconCodePoint (const std::string &iconName)
 
static std::string getIconFamily (const std::string &iconName)
 
static std::string getIconUtf8String (const std::string &iconName)
 
static const std::vector< std::string > & getSupportedIcons ()
 
static std::string getTTFLocation (const std::string &iconName)
 
static std::string getVersion ()
 
static std::string getWOFF2Location (const std::string &iconName)
 
static std::string getWOFFLocation (const std::string &iconName)
 
static bool isIconSupported (const std::string &iconName)
 

Detailed Description

Helper class for the configuration of a Font Awesome glyph.

Font Awesome is a free iconic font by Dave Gandy (see https://fontawesome.com) offering more than 500 customizable scalable vector icons.

A glyph has been added to Tulip enabling to use these great icons as nodes and edges extremities shapes.

That class offers utility functions and supported icons names constants.

To set a node glyph as a Font Awesome icon, the Icon glyph must be associated to the node through the modification of the "viewShape" integer property attached to the graph. The name of the icon to use must then be set in the "viewIcon" string property. As an example, the following code snippet activates the Font Awesome glyph for all nodes and sets the "user" icon.

// graph is a pointer to a tlp::Graph object
tlp::IntegerProperty *viewShape = graph->getProperty<tlp::IntegerProperty>("viewShape");
tlp::StringProperty *viewIcon = graph->getProperty<tlp::StringProperty>("viewIcon");
// sets the Icon glyph on all nodes
viewShape->setAllNodeValue(tlp::NodeShape::Icon);
// sets the "user" glyph for all nodes
viewIcon->setAllNodeValue("fa-user");

Definition at line 58 of file TulipFontAwesome.h.

Member Function Documentation

◆ getIconCodePoint()

static unsigned int tlp::TulipFontAwesome::getIconCodePoint ( const std::string &  iconName)
static

Returns the Unicode code point associated to an icon name

Parameters
iconNamethe name of the icon to get the codepoint

◆ getIconFamily()

static std::string tlp::TulipFontAwesome::getIconFamily ( const std::string &  iconName)
static

Returns the font family name associated to an icon name

Parameters
iconNamethe name of the icon

◆ getIconUtf8String()

static std::string tlp::TulipFontAwesome::getIconUtf8String ( const std::string &  iconName)
static

Returns an UTF-8 encoded string of a Font Awesome icon

Parameters
iconNamea Font Awesome icon name
Returns

◆ getSupportedIcons()

static const std::vector<std::string>& tlp::TulipFontAwesome::getSupportedIcons ( )
static

Returns the list of supported Font Awesome icons names

◆ getTTFLocation()

static std::string tlp::TulipFontAwesome::getTTFLocation ( const std::string &  iconName)
static

Returns the location of the Font Awesome .ttf file bundled with Tulip

◆ getVersion()

static std::string tlp::TulipFontAwesome::getVersion ( )
static

Returns the version of the Font Awesome icons bundled with Tulip

◆ getWOFF2Location()

static std::string tlp::TulipFontAwesome::getWOFF2Location ( const std::string &  iconName)
static

Returns the location of the Font Awesome .woff2 file bundled with Tulip

◆ getWOFFLocation()

static std::string tlp::TulipFontAwesome::getWOFFLocation ( const std::string &  iconName)
static

Returns the location of the Font Awesome .woff file bundled with Tulip

◆ isIconSupported()

static bool tlp::TulipFontAwesome::isIconSupported ( const std::string &  iconName)
static

Checks if the provided Font Awesome icon name is supported

Parameters
iconNamethe name of the icon to check support