Tulip  5.2.0
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

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
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
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
static const std::vector<std::string>& tlp::TulipFontAwesome::getSupportedIcons ( )
static

Returns the list of supported Font Awesome icons names

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

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

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

Returns the version of the Font Awesome icons bundled with Tulip

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

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

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

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

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