| 1 |
Support development of IconFontCppHeaders through [GitHub Sponsors](https://github.com/sponsors/dougbinks) or [Patreon](https://www.patreon.com/enkisoftware) |
| 2 |
|
| 3 |
[<img src="https://img.shields.io/static/v1?logo=github&label=Github&message=Sponsor&color=#ea4aaa" width="200"/>](https://github.com/sponsors/dougbinks) [<img src="https://c5.patreon.com/external/logo/[email protected]" alt="Become a Patron" width="150"/>](https://www.patreon.com/enkisoftware) |
| 4 |
|
| 5 |
|
| 6 |
# IconFontCppHeaders |
| 7 |
|
| 8 |
[https://github.com/juliettef/IconFontCppHeaders](https://github.com/juliettef/IconFontCppHeaders) |
| 9 |
|
| 10 |
C++11, C89 headers and C# classes for icon fonts Font Awesome, Fork Awesome, Google Material Design icons, Kenney game icons and Fontaudio. |
| 11 |
|
| 12 |
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. |
| 13 |
|
| 14 |
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. |
| 15 |
|
| 16 |
## Icon Fonts |
| 17 |
|
| 18 |
### [Font Awesome](https://fontawesome.com) |
| 19 |
|
| 20 |
* [https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome) |
| 21 |
|
| 22 |
#### Font Awesome 4 |
| 23 |
* [icons.yml](https://github.com/FortAwesome/Font-Awesome/blob/fa-4/src/icons.yml) |
| 24 |
* [fontawesome-webfont.ttf](https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf) |
| 25 |
|
| 26 |
#### Font Awesome 5 - see [notes below](#notes-about-font-awesome-5) |
| 27 |
* [icons.yml](https://github.com/FortAwesome/Font-Awesome/blob/master/metadata/icons.yml) |
| 28 |
* [fa-brands-400.ttf](https://github.com/FortAwesome/Font-Awesome/blob/master/webfonts/fa-brands-400.ttf) |
| 29 |
* [fa-regular-400.ttf](https://github.com/FortAwesome/Font-Awesome/blob/master/webfonts/fa-regular-400.ttf) |
| 30 |
* [fa-solid-900.ttf](https://github.com/FortAwesome/Font-Awesome/blob/master/webfonts/fa-solid-900.ttf) |
| 31 |
|
| 32 |
#### Font Awesome 5 Pro - this is a paid product, see [notes below](#notes-about-font-awesome-5) |
| 33 |
Files downloaded from [fontawesome.com](https://fontawesome.com) |
| 34 |
|
| 35 |
* ..\fontawesome-pro-n.n.n-web\metadata\icons.yml |
| 36 |
* ..\fontawesome-pro-n.n.n-web\webfonts\fa-brands-400.ttf |
| 37 |
* ..\fontawesome-pro-n.n.n-web\webfonts\fa-light-300.ttf |
| 38 |
* ..\fontawesome-pro-n.n.n-web\webfonts\fa-regular-400.ttf |
| 39 |
* ..\fontawesome-pro-n.n.n-web\webfonts\fa-solid-900.ttf |
| 40 |
|
| 41 |
### [Fork Awesome](https://forkawesome.github.io/Fork-Awesome) |
| 42 |
* [https://github.com/ForkAwesome/Fork-Awesome](https://github.com/ForkAwesome/Fork-Awesome) |
| 43 |
* [icons.yml](https://github.com/ForkAwesome/Fork-Awesome/blob/master/src/icons/icons.yml) |
| 44 |
* [forkawesome-webfont.ttf](https://github.com/ForkAwesome/Fork-Awesome/blob/master/fonts/forkawesome-webfont.ttf) |
| 45 |
|
| 46 |
### [Google Material Design icons](https://design.google.com/icons) |
| 47 |
* [https://github.com/google/material-design-icons](https://github.com/google/material-design-icons) |
| 48 |
* [codepoints](https://github.com/google/material-design-icons/blob/master/iconfont/codepoints) |
| 49 |
* [MaterialIcons-Regular.ttf](https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf) |
| 50 |
|
| 51 |
### [Kenney Game icons](http://kenney.nl/assets/game-icons) and [Game icons expansion](http://kenney.nl/assets/game-icons-expansion) |
| 52 |
* [https://github.com/nicodinh/kenney-icon-font](https://github.com/nicodinh/kenney-icon-font) |
| 53 |
* [kenney-icons.css](https://github.com/nicodinh/kenney-icon-font/blob/master/css/kenney-icons.css) |
| 54 |
* [kenney-icon-font.ttf](https://github.com/nicodinh/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf) |
| 55 |
|
| 56 |
### [Fontaudio](https://github.com/fefanto/fontaudio) |
| 57 |
* [https://github.com/fefanto/fontaudio](https://github.com/fefanto/fontaudio) |
| 58 |
* [fontaudio.css](https://github.com/fefanto/fontaudio/blob/master/font/fontaudio.css) |
| 59 |
* [fontaudio.ttf](https://github.com/fefanto/fontaudio/blob/master/font/fontaudio.ttf) |
| 60 |
|
| 61 |
## Notes about Font Awesome 5 |
| 62 |
### Codepoints grouping |
| 63 |
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. |
| 64 |
|
| 65 |
### Generating Pro header files |
| 66 |
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. |
| 67 |
|
| 68 |
## Ionicons and webfont Material Design Icons |
| 69 |
Unsupported as of 29 Apr 2020. See [Issue #16](https://github.com/juliettef/IconFontCppHeaders/issues/16). |
| 70 |
|
| 71 |
## Example Code |
| 72 |
|
| 73 |
Using [Dear ImGui](https://github.com/ocornut/imgui) as an example UI library: |
| 74 |
|
| 75 |
```Cpp |
| 76 |
|
| 77 |
#include "IconsFontAwesome5.h" |
| 78 |
|
| 79 |
ImGuiIO& io = ImGui::GetIO(); |
| 80 |
io.Fonts->AddFontDefault(); |
| 81 |
|
| 82 |
// merge in icons from Font Awesome |
| 83 |
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; |
| 84 |
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; |
| 85 |
io.Fonts->AddFontFromFileTTF( FONT_ICON_FILE_NAME_FAS, 16.0f, &icons_config, icons_ranges ); |
| 86 |
// use FONT_ICON_FILE_NAME_FAR if you want regular instead of solid |
| 87 |
|
| 88 |
// in an imgui window somewhere... |
| 89 |
ImGui::Text( ICON_FA_PAINT_BRUSH " Paint" ); // use string literal concatenation |
| 90 |
// outputs a paint brush icon and 'Paint' as a string. |
| 91 |
``` |
| 92 |
|
| 93 |
## Projects using the font icon header files |
| 94 |
|
| 95 |
### [Avoyd](https://www.enkisoftware.com/avoyd) |
| 96 |
Avoyd is a 6 degrees of freedom voxel game that includes a voxel editor tool. |
| 97 |
[www.avoyd.com](https://www.avoyd.com) |
| 98 |
|
| 99 |
The voxel editor's UI uses Dear ImGui with Font Awesome icon fonts. |
| 100 |
|
| 101 |
 |
| 102 |
|
| 103 |
### [bgfx](https://github.com/bkaradzic/bgfx) |
| 104 |
Cross-platform rendering library. |
| 105 |
[bkaradzic.github.io/bgfx/overview](https://bkaradzic.github.io/bgfx/overview.html) |
| 106 |
|
| 107 |
### [glChAoS.P](https://github.com/BrutPitt/glChAoS.P) |
| 108 |
Real time 3D strange attractors scout. |
| 109 |
[www.michelemorrone.eu/glchaosp](https://www.michelemorrone.eu/glchaosp) |
| 110 |
|
| 111 |
 |
| 112 |
|
| 113 |
### [iPlug2](https://github.com/iplug2/iplug2) |
| 114 |
Cross platform C++ audio plug-in framework |
| 115 |
[iplug2.github.io](https://iplug2.github.io) |
| 116 |
|
| 117 |
### [Tracy Profiler](https://bitbucket.org/wolfpld/tracy/src/master/) |
| 118 |
Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications. |
| 119 |
|
| 120 |
[](https://www.youtube.com/watch?v=uJkrFgriuOo) |
| 121 |
|
| 122 |
### [Visual 6502 Remix](https://github.com/floooh/v6502r) |
| 123 |
Transistor level 6502 Hardware Simulation |
| 124 |
[floooh.github.io/visual6502remix](https://floooh.github.io/visual6502remix) |
| 125 |
|
| 126 |
## Credits |
| 127 |
|
| 128 |
Development - [Juliette Foucaut](http://www.enkisoftware.com/about.html#juliette) - [@juliettef](https://github.com/juliettef) |
| 129 |
Requirements - [Doug Binks](http://www.enkisoftware.com/about.html#doug) - [@dougbinks](https://github.com/dougbinks) |
| 130 |
[None](https://bitbucket.org/duangle/nonelang/src) language implementation and [refactoring](https://gist.github.com/paniq/4a734e9d8e86a2373b5bc4ca719855ec) - [Leonard Ritter](http://www.leonard-ritter.com/) - [@paniq](https://github.com/paniq) |
| 131 |
Suggestion to add a define for the ttf file name - [Sean Barrett](https://nothings.org/) - [@nothings](https://github.com/nothings) |
| 132 |
Initial Font Awesome 5 implementation - [Codecat](https://codecat.nl/) - [@codecat](https://github.com/codecat) |
| 133 |
Suggestion to add Fork Awesome - [Julien Deswaef](http://xuv.be/) - [@xuv](https://github.com/xuv) |
| 134 |
Suggestion to add Ionicons - [Omar Cornut](http://www.miracleworld.net/) - [@ocornut](https://github.com/ocornut) |
| 135 |
C# language implementation - Rokas Kupstys - [@rokups](https://github.com/rokups) |
| 136 |
Suggestion to add Material Design Icons - Gustav Madeso - [@madeso](https://github.com/madeso) |
| 137 |
Fontaudio implementation - [Oli Larkin](https://www.olilarkin.co.uk/) - [@olilarkin](https://github.com/olilarkin) |