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

Issues
  • 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
  • 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
  • Simple fix for  Material Design - GenerateIconFontCppHeaders.py

    Simple fix for Material Design - GenerateIconFontCppHeaders.py

    class FontMD( Font ):               # Material Design
        font_name = 'Material Design'
        font_abbr = 'MD'
        # font_data = 'https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints'
        # https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf
        font_data = 'https://raw.githubusercontent.com/google/material-design-icons/master/font/MaterialIcons-Regular.codepoints'
        ttfs = [[ font_abbr, 'MaterialIcons-Regular.ttf', 'https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.ttf' ]]
    
        @classmethod
        def get_icons( cls, input_data ):
            icons_data = {}
            lines = str.split( input_data, '\n' )
            if lines:
                font_min = 'ffff'
                font_max = '0'
                number_limit = int('ffff', 16)
                icons = []
                for line in lines :
                    words = str.split(line)
                    if words and len( words ) >= 2:
                        word_int = int(words[1], 16)
                        if word_int > number_limit:
                            print(words, 'Jump')
                            continue
                        if words[ 1 ] < font_min:
                            font_min = words[ 1 ]
                        if words[ 1 ] >= font_max:
                            font_max = words[ 1 ]
                        icons.append( words )
                icons_data.update({ 'font_min' : font_min,
                                    'font_max' : font_max,
                                    'icons' : icons })
                print(font_min, font_max)
            return icons_data
    

    The number_limit is for goat 10fffd. goat 10fffd is a invalid data, no this icon.

    Tested in Python 3.9.9, macOS.

    bug 
    opened by Aincvy 1
  • ForkAwesome FontAwesome confusion

    ForkAwesome FontAwesome confusion

    https://github.com/juliettef/IconFontCppHeaders/blob/9cab4b9b82cb1b75a97a0e7e3ea01dd1fbc4c1a9/IconsForkAwesome.h#L6

    i think this line should be

    #define FONT_ICON_FILE_NAME_FK "forkawesome-webfont.ttf"

    bug 
    opened by olilarkin 1
  • Porting the generation script to python 3

    Porting the generation script to python 3

    Question to anyone running the python script GenerateIconFontCppHeaders.py: would it be problematic for you if I ported the script from python 2.7 to python 3?

    I'm planning to break the compatibility with python 2.7 to keep the script as simple as possible. There's a good chance the port will fix issue #11 with Material Design Icons.

    Let me know what you think. I'll leave this question open until the 20th Oct.

    question 
    opened by juliettef 0
  • Material Design Icon generation not working

    Material Design Icon generation not working

    Crash due to extended unicode range in source.

    No workaround for generating MDI fonts. Temporarily removed fontMDI from fonts list to prevent interference with other icons generation.

    bug 
    opened by juliettef 0
  • [C#, Python] Fix C# duplicate path variable, add python module geneartion

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

    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.

    opened by yhyu13 0
  • 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.

    opened by jakerieger 0
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 3 Apr 23, 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 6 Jul 20, 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 9 May 31, 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 341 Aug 4, 2022
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.2k Aug 5, 2022
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 7.8k Aug 8, 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.5k Jul 31, 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 Jul 29, 2022
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.3k Aug 2, 2022
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.1k Aug 8, 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 182 Jul 24, 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 320 Aug 3, 2022
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 Aug 7, 2022
[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 15 Nov 20, 2021
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 32 Jul 29, 2022
Notcurses: blingful TUIs and character graphics

blingful character graphics/TUI library. definitely not curses.

nick black 2.3k Aug 10, 2022
Nvui: A NeoVim GUI written in C++ and Qt

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

Rohit Pradhan 1.6k Aug 6, 2022
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 10k Aug 3, 2022