5.3 KiB
IconFontCppHeaders
https://github.com/juliettef/IconFontCppHeaders
C++11 and C89 headers and C# classes for icon fonts Font Awesome, Fork Awesome, Google Material Design icons, Material Design Icons, Kenney game icons and Ionicons.
A set of header files and classes for using icon fonts in C, C++ and C#, along with the python generator used to create the files.
Each header contains defines for one font, with each icon code point defined as ICON_*, along with the min and max code points for font loading purposes.
Fonts
- Font Awesome
- GitHub repository
- Font Awesome 4
- Font Awesome 5
- Fork Awesome
- Google Material Design icons
- Material Design icons
- Kenney Game icons and Game icons expansion
- Ionicons
Font Awesome 5 notes
Font Awesome 5 splits the different styles of icons into different font files: solid, regular and brands
- identical font codepoints for styles solid and regular (regular is a subset of solid) icon font file;
- a different set of codepoints for style brands icon font file
We have put the brands into a different header file, as the brands codepoints are mixed with the standard icons' so the fonts cannot easily be used without switching between the two fonts in your code.
The codepoints only cover the free fonts.
Example Code
Using dear imgui as an example UI library:
#include "IconsFontAwesome5.h"
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontDefault();
// merge in icons from Font Awesome
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
io.Fonts->AddFontFromFileTTF( FONT_ICON_FILE_NAME_FAS, 16.0f, &icons_config, icons_ranges );
// use FONT_ICON_FILE_NAME_FAR if you want regular instead of solid
// in an imgui window somewhere...
ImGui::Text( ICON_FA_PAINT_BRUSH " Paint" ); // use string literal concatenation
// outputs a paint brush icon and 'Paint' as a string.
Projects using the font icon header files
Avoyd
Avoyd is an abstract 6 degrees of freedom voxel game. The voxel editor's Edit Tool UI uses dear imgui with Font Awesome icon fonts.
bgfx
Cross-platform rendering library.
Credits
Development - Juliette Foucaut - @juliettef
Requirements - Doug Binks - @dougbinks
None language implementation and refactoring - Leonard Ritter - @paniq
Suggestion to add a define for the ttf file name - Sean Barrett - @nothings
Initial Font Awesome 5 implementation - Codecat - @codecat
Suggestion to add Fork Awesome - Julien Deswaef - @xuv
Suggestion to add Ionicons - Omar Cornut - @ocornut
C# language implementation - Rokas Kupstys - @rokups
Suggestion to add Material Design Icons - Gustav Madeso - @madeso