Branimir Karadžić db37bd1bcd Added icon font headers. 10 年之前
..
.gitignore db37bd1bcd Added icon font headers. 10 年之前
GenerateIconFontCppHeaders.py db37bd1bcd Added icon font headers. 10 年之前
LICENSE db37bd1bcd Added icon font headers. 10 年之前
README.md db37bd1bcd Added icon font headers. 10 年之前
icons_font_awesome.h db37bd1bcd Added icon font headers. 10 年之前
icons_kenney.h db37bd1bcd Added icon font headers. 10 年之前
icons_material_design.h db37bd1bcd Added icon font headers. 10 年之前

README.md

IconFontCHeaders

C++11 and C89 headers for icon fonts Font Awesome, Google Material Design icons and Kenney game icons.

A set of header files for using icon fonts in 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

Usage

Using dear imgui as an example UI library:

#include "IconsFontAwesome.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( fontFile.c_str(), 16.0f, &icons_config, icons_ranges);

// in an imgui window somewhere...
ImGui::Text( ICON_FA_FILE "  File" ); // use string literal concatenation, ouputs a file icon and File as a string.