C, C++ headers and C# classes for icon fonts: Font Awesome, Fork Awesome, Material Design, Kenney game icons and Fontaudio

Overview

Support development of IconFontCppHeaders through GitHub Sponsors or Patreon

Become a Patron

IconFontCppHeaders

https://github.com/juliettef/IconFontCppHeaders

C, C++ headers and C# classes for icon fonts Font Awesome, Fork Awesome, Google Material Design icons, Kenney game icons and Fontaudio.

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.

In addition the python script can be used to convert ttf font files to C and C++ headers. Each ttf icon font file is converted to a C and C++ header file containing a single array of bytes. To enable conversion, run the GenerateIconFontCppHeaders.py script with 'ttf2headerC = True'.

Icon Fonts

Font Awesome

Font Awesome 4

Font Awesome 5 - see notes below

Font Awesome 5 Pro - this is a paid product, see notes below

Files downloaded from fontawesome.com

  • ..\fontawesome-pro-n.n.n-web\metadata\icons.yml
  • ..\fontawesome-pro-n.n.n-web\webfonts\fa-brands-400.ttf
  • ..\fontawesome-pro-n.n.n-web\webfonts\fa-light-300.ttf
  • ..\fontawesome-pro-n.n.n-web\webfonts\fa-regular-400.ttf
  • ..\fontawesome-pro-n.n.n-web\webfonts\fa-solid-900.ttf

Fork Awesome

Google Material Design icons - see Issue #19

Kenney Game icons and Game icons expansion

Fontaudio

Notes about Font Awesome 5

Codepoints grouping

Font Awesome 5 splits the different styles of icons into different font files with identical codepoints for light, regular and solid styles, and a different set of codepoints for brands. We have put the brands into a separate header file.

Generating Pro header files

Download the Font Awesome Pro Web package. To generate the headers, drop icons.yml in the same directory as GenerateIconFontCppHeaders.py before running the script. The file icons.yml is under ..\fontawesome-pro-n.n.n-web\metadata\icons.yml where n.n.n is the version number.

Ionicons and webfont Material Design Icons

Unsupported as of 29 Apr 2020. See Issue #16.

Example Code

Using Dear ImGui as an example UI library:

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.">
#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 a 6 degrees of freedom voxel game that includes a voxel editor tool.
www.avoyd.com

The voxel editor's UI uses Dear ImGui with Font Awesome icon fonts.

Screenshot of the the game Avoyd's Voxel Editor UI using an IconFontCppHeaders header file for Font Awesome with Dear ImGui

bgfx

Cross-platform rendering library.
bkaradzic.github.io/bgfx/overview

glChAoS.P

Real time 3D strange attractors scout.
www.michelemorrone.eu/glchaosp

Screenshot of glChAoS.P UI using IconFontCppHeaders header file for Font Awesome with Dear ImGui

iPlug2

Cross platform C++ audio plug-in framework
iplug2.github.io

Lumix Engine

3D C++ open source game engine

Screenshot of Lumix Engine editor using IconFontCppHeaders header file for Font Awesome with Dear ImGui

Tracy Profiler

Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications.

New features in Tracy Profiler v0.6

Visual 6502 Remix

Transistor level 6502 Hardware Simulation
floooh.github.io/visual6502remix

Related Tools

ImGuiFontStudio - Create font subsets

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
Fontaudio implementation - Oli Larkin - @olilarkin
Initial ttf to C and C++ headers conversion implementation - Charles Mailly - @Caerind

Comments
  • Binarize fonts during generation

    Binarize fonts during generation

    Hello !

    I don't know if this will help anyone, but I find that feature quite useful for me.

    It is easy to enable/disable by simply changing the "binarizeC" variable in main.

    enhancement 
    opened by Caerind 8
  • I use consFontAwesome.h in VS2013 +Imgui 1.50,but compile turn on error

    I use consFontAwesome.h in VS2013 +Imgui 1.50,but compile turn on error

    I use consFontAwesome.h in VS2013 +Imgui 1.50,but compile turn on C2065 error:u8 undeclared identifier as blow: step1: add #include "IconsFontAwesome.h" in main function; step2: ImGuiIO& io = ImGui::GetIO(); io.Fonts->AddFontDefault(); // merge in icons from Font Awesome static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; io.Fonts->AddFontFromFileTTF("../../extra_fonts/fontawesome-webfont.ttf", 16.0f, &icons_config, icons_ranges);

    step3:ImGui::Text( ICON_FA_FILE " File" );

    but compile turn on C2065 error:u8 undeclared identifier as blow: qq 20160707230812

    opened by zhouxs1023 8
  • C++20 u8 literals incompatible with char literals

    C++20 u8 literals incompatible with char literals

    C++20 changed the underlying type of u8 literals from char to char8_t, which makes them incompatible. You can't concatenate them, nor can you pass char8_t* to functions expecting char*.

    A few ways of mitigating this are discussed here, one of which being ordinary single byte escape sequences like it's done in the C version of the header files.

    I'm not sure if this needs fixing at all, since anyone who requires interoperability with char can switch to the C headers. Just wanted to bring it to your attention.

    bug 
    opened by pezcode 7
  • Material Design Icons & ImGui

    Material Design Icons & ImGui

    Hello, I tried to load the MDI font with ImGui, using the code passed in the Readme to load it :

            io.Fonts->AddFontDefault();
    
            ImFontConfig config;
            config.MergeMode = true;
            config.GlyphMinAdvanceX = 13.0f; // Use if you want to make the icon monospaced
            static const ImWchar icon_ranges[] = { ICON_MIN_MDI, ICON_MAX_MDI, 0 };
            _icon = io.Fonts->AddFontFromFileTTF("./resources/Editor/materialdesignicons-webfont.ttf", 13.0f, &config, icon_ranges);
    

    but the text using the icons keeps showing me no icons and incorrect characters. Using this code ImGui::Button(ICON_MDI_PLAY); show me this : image I also looked in the Styles editor of imgui, but the font doesn't appear in the default font. I tried with Font Awesome 5, and everything worked fine.

    opened by BluTree 4
  • Using icons in X11 c++ app

    Using icons in X11 c++ app

    Hi there. It's been a while since I'm trying to use this icon pack header in my X11 window manager (written in c++) but I couldn't. I hope you can help me with that. So here is what I have done :

    1 - Downloaded the c++ header file. As I noticed in each header file it has been mentioned what font I should use. So I downloaded the fonts accordingly. put them in .font folder and fc-cache -rv

    2 - then I tried to use the following code to show an icon but what I get is an empty rectangle. (I tried to simplify it as much as i could but you can find the link of repo at the end)

    #define ICON_FONT "Font Awesome 6 Free-7" 
    
    //also tested with "FontAwesome-7" 
    //also tested with "fontawesome-7" 
    
    auto d = XftDrawCreate(this->CurrentDisplay, this->root, DefaultVisual(this->CurrentDisplay, DefaultScreen(this->CurrentDisplay)), DefaultColormap(this->CurrentDisplay, DefaultScreen(this->CurrentDisplay)));
    auto iconfont = XftFontOpenName(this->CurrentDisplay, DefaultScreen(this->CurrentDisplay), ICON_FONT);
    XftDrawString8(d, &selectedcolor, iconfont, 10 ,  10 ,  (FcChar8 *)ICON_MAX_FA, 1);
    

    Btw that code is working when I want simply to draw a text. Also here is the whole repo in case you want to check

    question 
    opened by Foroughi 3
  • [C#, Python] Fix C# duplicate path variable, add python module generation

    [C#, Python] Fix C# duplicate path variable, add python module generation

    1, Fix C# duplicate path variable Make path variable ending with abbreviation just like c++ to avoid duplicate variable name

    2, Add python module generation Following the python naming convention, generate python module (just a data class) that can be imported and used by imgui python bindings

    3, All files are re-generated and updated by a run of the generate python script today.

    enhancement 
    opened by yhyu13 3
  • Add support for go.

    Add support for go.

    Thanks for making IconFontCppHeaders available! I've added support for Go for use in a personal project and thought that might be useful to have in the main distribution.

    Each font is represented by a Font-typed variable in the IconFontCppHeaders namespace, where Font is a small struct that wraps up the filenames and range of unicode values.

    Unlike the C++/C# bindings, the name->unicode mappings for each glyph are stored in a map, rather than in a flat set of defined constants. There is thus some additional overhead in looking up a given mapping, though with some flexibility on the user side in return (ability to iterate over the mappings, etc.)

    enhancement 
    opened by mmp 2
  • Add Font Awesome 6 Pro C/C++ header

    Add Font Awesome 6 Pro C/C++ header

    Generated the defines for FA6 Pro since this repo doesn't have them. Didn't use the python script so it's missing some of the comments but it uses the same naming scheme.

    enhancement 
    opened by jakerieger 2
  • ICON_MAX_MD from IconMaterialDesgin.h can't use in imgui

    ICON_MAX_MD from IconMaterialDesgin.h can't use in imgui

    I got a error when setting the icons range using ICON_MAX_MD, here is the code const ImWchar md_icons_ranges[] = { ICON_MIN_MD, ICON_MAX_MD, 0}; And I used it to attach the ttf to my custom fonts io.Fonts->AddFontFromFileTTF(FONT_ICON_FILE_NAME_MD, 18.0f, &config, md_icons_ranges); However, There is a error in the first line said that Constant expression evaluates to 1114109 which cannot be narrowed to type 'ImWchar' (aka 'unsigned short')

    enhancement 
    opened by ShawnWicky 2
  • MaterialDesignIcons

    MaterialDesignIcons

    Hello,

    It would be great if the material design icons would be included as well. From what I can tell they are the google material icons with community extensions and a acceptable license.

    Source repo: https://github.com/Templarian/MaterialDesign

    Font & css repo: https://github.com/Templarian/MaterialDesign-Webfont

    Icons list: https://cdn.materialdesignicons.com/2.4.85/ https://materialdesignicons.com/

    enhancement 
    opened by madeso 2
  • Use IconsKenney_c.h to merge iconfont,but turn on error

    Use IconsKenney_c.h to merge iconfont,but turn on error

    VS2013+imgui1.48 step1:add header file #include "IconsKenney_c.h" step2: merge in icons from IconsKenney static const ImWchar icons_ranges[] = { ICON_MIN_KI, ICON_MAX_KI, 0 }; ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; icons_config.MergeGlyphCenterV = true; io.Fonts->AddFontFromFileTTF("../../extra_fonts/kenney-icon-font.ttf", 32.0f, &icons_config, icons_ranges); step3:add iconfont in imgui windows ImGui::Button(ICON_KI_MOVIE, ImVec2(32, 32)); Run later will turn on error as below: qq 20160710012724

    opened by zhouxs1023 2
  • Duplicate ICON_MD_FLOURESCENT in IconsMaterialDesign.h

    Duplicate ICON_MD_FLOURESCENT in IconsMaterialDesign.h

    Hi, In IconsMaterialDesign.h, there are between lines 827 and 829 duplicated ICON_MD_FLOURESCENT. Compiling with this file gives annoying preprocessor warnings. I think it was introduced in 80b7e5a11f29c60f89444b0030f916850977a710. It compiles fine before this commit.

    third-party issue 
    opened by jokteur 1
Owner
Juliette Foucaut
Game developer, C++, python, testing. Co-founder of enkisoftware with @dougbinks. Occasionally available for consultancy.
Juliette Foucaut
Material Design GUI Toolkit

GUI toolkit in Material Design style

Maks Makuta 2 Sep 28, 2022
AnUI is a powerful Graphical User Interface framework made for people that actually care about design!

What's AuUI ** Project is not finished ** AuUI, an abbreviation for "Actual Understandable User Interface" is a graphical user interface framework to

Goat 4 Jun 17, 2022
An integrated information center created with dear ImGui using modern C++ design / coding style.

ImGui info-center Introduction An integrated notification and information center created with dear ImGui. Interfaces and variables are designed under

Feej 7 Oct 29, 2022
Radio.Garden desktop app and game overlay

Radio.Garten A radio.garden desktop client and overlay written with SDL2 and ImGui Overlay Example Overlay Compatibility Please check the compatibilit

null 12 Dec 8, 2022
Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.

xtd Modern C++17/20 framework to create console (CLI), forms (GUI like WinForms) and tunit (unit tests like Microsoft Unit Testing Framework) applicat

Gammasoft 441 Jan 4, 2023
Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids.

Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids. It animates its contents by using parabolic zoom effect and trys to be there only when it is needed.

KDE GitHub Mirror 1.4k Jan 7, 2023
Build performant, native and cross-platform desktop applications with Node.js and CSS like styling. 🚀

NodeGui Build performant, native and cross-platform desktop applications with Node.js and CSS like styling. ?? NodeGUI is powered by Qt5 ?? which make

NodeGui 8.1k Dec 30, 2022
Purely native C++ cross-platform GUI framework for Android and iOS development. https://www.boden.io

BODEN CROSS-PLATFORM FRAMEWORK Build purely native cross-platform experiences with Boden Website ⬡ Getting Started ⬡ API Reference ⬡ Guides ⬡ Twitter

Ashampoo Systems GmbH & Co KG 1.6k Dec 27, 2022
GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features.

GacUI GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features. Read the LICENSE first

Vczh Libraries 2.1k Jan 7, 2023
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Jan 2, 2023
Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL

NanoGUI NanoGUI is a minimalistic cross-platform widget library for OpenGL 3+, GLES 2/3, and Metal. It supports automatic layout generation, stateful

Mitsuba Physically Based Renderer 1.2k Dec 28, 2022
A barebones single-header GUI library for Win32 and X11.

luigi A barebones single-header GUI library for Win32 and X11. Building example Windows Update luigi_example.c to #define UI_WINDOWS at the top of the

Nakst 235 Dec 30, 2022
An efficient graphical Minecraft seed finder and map viewer.

Cubiomes Viewer provides a graphical interface for the efficient and flexible seed-finding utilities provided by cubiomes and a map viewer for the Minecraft biomes and structure generation.

null 492 Jan 7, 2023
DeskGap is a framework for building cross-platform desktop apps with web technologies (JavaScript, HTML and CSS).

A cross-platform desktop app framework based on Node.js and the system webview

Wang, Chi 1.8k Jan 4, 2023
[WIP] Demo of a minimal but functional Dawn-based WebGPU client and server

dawn client-server example The goal of this demo is to create a minimal but functional Dawn-based WebGPU client and server with the following traits:

Rasmus 16 Sep 19, 2022
A minimalist andf platform-agnostic application layer for writing graphical applications, with a strong emphasis on simplicity and ease of use.

SlimApp A minimalist(*) and platform-agnostic application layer for writing graphical applications. Available as either a single header file or a dire

Arnon Marcus 34 Dec 18, 2022
Notcurses: blingful TUIs and character graphics

blingful character graphics/TUI library. definitely not curses.

nick black 2.5k Jan 9, 2023
Nvui: A NeoVim GUI written in C++ and Qt

Nvui: A NeoVim GUI written in C++ and Qt

Rohit Pradhan 1.6k Jan 7, 2023
LVGL - Light and Versatile Graphics Library

Powerful and easy-to-use embedded GUI library with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash).

LVGL 11k Jan 5, 2023