### Integrating Font Awesome with Dear ImGui Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md Demonstrates how to load and use Font Awesome icons within a Dear ImGui application. It covers merging icon fonts with the default font and displaying icons using specific macros. ```C++ #include "IconsFontAwesome5.h" ImGuiIO& io = ImGui::GetIO(); io.Fonts->AddFontDefault(); float baseFontSize = 13.0f; float iconFontSize = baseFontSize * 2.0f / 3.0f; static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_16_FA, 0 }; ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; icons_config.GlyphMinAdvanceX = iconFontSize; io.Fonts->AddFontFromFileTTF( FONT_ICON_FILE_NAME_FAS, iconFontSize, &icons_config, icons_ranges ); ImGui::Text( ICON_FA_PAINT_BRUSH " Paint" ); ``` -------------------------------- ### ImGuiFontStudio Font Subset Creation Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md ImGuiFontStudio is a tool designed for creating font subsets, likely utilizing IconFontCppHeaders or similar mechanisms to manage icon fonts within a Dear ImGui environment. ```cpp // Conceptual usage in ImGuiFontStudio // Assumes ImGuiFontStudio uses IconFontCppHeaders to manage font subsets #include "imgui.h" #include "imgui_internal.h" #include "imnodes.h" // Functionality to load and manage icon fonts void LoadIconFont(ImFontAtlas* atlas, const char* fontPath, float fontSize, const ImWchar* ranges, const char* fontName) { ImFontConfig config; config.OversampleH = 2; config.OversampleV = 1; config.GlyphExtraSpacing.x = 1.0f; config.MergeMode = true; config.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LoadGlyphFont; atlas->AddFontFromFileTTF(fontPath, fontSize, &config, ranges); } // Example of using a generated header #include "IconsFontAwesome.h" void RenderFontStudioUI(ImFontAtlas* atlas) { ImGui::Begin("Font Studio"); // UI elements for selecting and subsetting fonts ImGui::Text("%s Font Management", FA_ICON_FONT); // ... other UI elements ... ImGui::End(); } ``` -------------------------------- ### Font Awesome 5 & 6 Notes Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md Provides information on handling different styles (light, regular, solid, brands) of Font Awesome icons. It explains how brands are separated into distinct header files due to different codepoint ranges. ```APIDOC Font Awesome 5 and 6: - Styles: light, regular, solid, brands. - Codepoints: Identical for light, regular, solid. Different for brands. - Header Files: Brands are in a separate header file. - Generating Pro Headers: - Download Font Awesome Pro Web package. - Place 'icons.yml' from 'metadata\icons.yml' in the script directory. - Run GenerateIconFontCppHeaders.py. - Icon Files: - ..\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 ``` -------------------------------- ### Avoyd Voxel Editor UI with Font Awesome Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md Avoyd, a voxel editor and FPS game, uses Dear ImGui with Font Awesome icon fonts integrated via IconFontCppHeaders for its user interface. ```cpp // Example usage in Avoyd (conceptual) // Assumes IconFontCppHeaders is used to generate a C++ header for Font Awesome #include "IconsFontAwesome.h" #include "imgui.h" void RenderUI() { ImGui::Begin("Voxel Editor"); ImGui::Text("%s", FA_ICON_SAVE); ImGui::Button("Save " FA_ICON_SAVE); ImGui::End(); } ``` -------------------------------- ### Lumix Engine Editor with Font Awesome Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md The Lumix Engine, a 3D C++ game engine, incorporates Font Awesome icons into its editor's UI using IconFontCppHeaders and Dear ImGui. ```cpp // Example usage in Lumix Engine Editor (conceptual) // Assumes IconFontCppHeaders is used to generate a C++ header for Font Awesome #include "IconsFontAwesome.h" #include "imgui.h" void RenderLumixEditorUI() { ImGui::Begin("Lumix Editor"); ImGui::Text("%s Settings", FA_ICON_COG); ImGui::SameLine(); if (ImGui::Button(FA_ICON_FOLDER_OPEN " Open Project")) { // Open project dialog } ImGui::End(); } ``` -------------------------------- ### glChAoS.P UI with Font Awesome Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md glChAoS.P, a real-time 3D strange attractors scout, utilizes IconFontCppHeaders to integrate Font Awesome icons within its Dear ImGui-based user interface. ```cpp // Example usage in glChAoS.P (conceptual) // Assumes IconFontCppHeaders is used to generate a C++ header for Font Awesome #include "IconsFontAwesome.h" #include "imgui.h" void RenderGlChaoSPUI() { ImGui::Begin("Attractor Scout"); if (ImGui::Button(FA_ICON_PLAY " Start Simulation")) { // Start simulation } ImGui::End(); } ``` -------------------------------- ### Generate C/C++ Headers from TTF Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md This script converts TTF font files into C and C++ header files. Each header contains a single byte array representing the font data. This is useful for embedding font resources directly into your projects. ```Python from generateIconFontCppHeaders import GenerateIconFontCppHeaders # Example usage to convert a TTF file to C/C++ headers # Assuming 'GenerateIconFontCppHeaders' class is available # generator = GenerateIconFontCppHeaders() # generator.ttf2headerC = True # generator.generate_font_headers('path/to/your/font.ttf', 'OutputHeaderName') ``` -------------------------------- ### Icon Font Header Structure Source: https://github.com/juliettef/iconfontcppheaders/blob/main/README.md Each generated header file defines constants for icon code points in the format ICON_*. It also includes definitions for the minimum, maximum, and 16-bit maximum code points, which are essential for font loading and compatibility with libraries that have specific code point range requirements. ```C++ #define ICON_SEARCH "\uF002" #define FONT_ICON_MIN_CODE 0xf000 #define FONT_ICON_MAX_CODE 0xffff #define FONT_ICON_MAX_CODE_16BIT 0xffff ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.