0
0
mirror of https://github.com/wolfpld/tracy.git synced 2026-01-18 17:11:26 +01:00

Add emoji font.

This commit is contained in:
Bartosz Taudul
2026-01-14 01:51:32 +01:00
parent 3547009d1c
commit 38b73254e9
6 changed files with 12 additions and 0 deletions

View File

@@ -160,6 +160,7 @@ add_library(TracyImGui STATIC EXCLUDE_FROM_ALL ${IMGUI_SOURCES})
target_include_directories(TracyImGui PUBLIC ${ImGui_SOURCE_DIR})
target_link_libraries(TracyImGui PUBLIC TracyFreetype)
target_compile_definitions(TracyImGui PRIVATE "IMGUI_ENABLE_FREETYPE")
target_compile_definitions(TracyImGui PUBLIC "IMGUI_USE_WCHAR32")
#target_compile_definitions(TracyImGui PUBLIC "IMGUI_DISABLE_OBSOLETE_FUNCTIONS")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND LEGACY)

View File

@@ -4228,3 +4228,5 @@ The following libraries are included with and used by the Tracy Profiler. Entrie
- Fira Code -- <https://github.com/tonsky/FiraCode>
- Font Awesome -- <https://fontawesome.com/>
- Noto Emoji -- <https://github.com/googlefonts/noto-emoji>

View File

@@ -4982,6 +4982,7 @@ The following libraries are included with and used by the Tracy Profiler. Entrie
\begin{itemize}
\item Fira Code -- \url{https://github.com/tonsky/FiraCode}
\item Font Awesome -- \url{https://fontawesome.com/}
\item Noto Emoji -- \url{https://github.com/googlefonts/noto-emoji}
\end{itemize}
\end{itemize}

View File

@@ -153,6 +153,7 @@ Embed(PROFILER_FILES FontNormal src/font/Roboto-Regular.ttf)
Embed(PROFILER_FILES FontBold src/font/Roboto-Bold.ttf)
Embed(PROFILER_FILES FontItalic src/font/Roboto-Italic.ttf)
Embed(PROFILER_FILES FontBoldItalic src/font/Roboto-BoldItalic.ttf)
Embed(PROFILER_FILES FontEmoji src/font/NotoEmoji-Regular.ttf)
Embed(PROFILER_FILES Manual ../manual/tracy.md)
set(INCLUDES "${CMAKE_CURRENT_BINARY_DIR}")

View File

@@ -13,6 +13,7 @@
#include "data/FontBold.hpp"
#include "data/FontBoldItalic.hpp"
#include "data/FontItalic.hpp"
#include "data/FontEmoji.hpp"
FontData g_fonts;
@@ -40,23 +41,29 @@ void LoadFonts( float scale )
auto fontBold = Unembed( FontBold );
auto fontBoldItalic = Unembed( FontBoldItalic );
auto fontItalic = Unembed( FontItalic );
auto fontEmoji = Unembed( FontEmoji );
io.Fonts->Clear();
g_fonts.normal = io.Fonts->AddFontFromMemoryTTF( (void*)fontNormal->data(), fontNormal->size(), round( 15.0f * scale ), &configBasic );
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge );
io.Fonts->AddFontFromMemoryTTF( (void*)fontEmoji->data(), fontEmoji->size(), round( 14.0f * scale ), &configMerge );
g_fonts.mono = io.Fonts->AddFontFromMemoryTTF( (void*)fontFixed->data(), fontFixed->size(), round( 15.0f * scale ), &configFixed );
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge );
io.Fonts->AddFontFromMemoryTTF( (void*)fontEmoji->data(), fontEmoji->size(), round( 14.0f * scale ), &configMerge );
g_fonts.bold = io.Fonts->AddFontFromMemoryTTF( (void*)fontBold->data(), fontBold->size(), round( 15.0f * scale ), &configBasic );
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge );
io.Fonts->AddFontFromMemoryTTF( (void*)fontEmoji->data(), fontEmoji->size(), round( 14.0f * scale ), &configMerge );
g_fonts.boldItalic = io.Fonts->AddFontFromMemoryTTF( (void*)fontBoldItalic->data(), fontBoldItalic->size(), round( 15.0f * scale ), &configBasic );
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge );
io.Fonts->AddFontFromMemoryTTF( (void*)fontEmoji->data(), fontEmoji->size(), round( 14.0f * scale ), &configMerge );
g_fonts.italic = io.Fonts->AddFontFromMemoryTTF( (void*)fontItalic->data(), fontItalic->size(), round( 15.0f * scale ), &configBasic );
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge );
io.Fonts->AddFontFromMemoryTTF( (void*)fontEmoji->data(), fontEmoji->size(), round( 14.0f * scale ), &configMerge );
FontNormal = round( scale * 15.f );
FontSmall = round( scale * 15 * 2.f / 3.f );

Binary file not shown.