mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-15 21:35:26 +00:00
Use embed utility to provide fonts. Replace Droid Sans with Roboto.
This commit is contained in:
@@ -128,6 +128,9 @@ set(PROFILER_FILES
|
||||
)
|
||||
|
||||
Embed(PROFILER_FILES SystemPrompt src/llm/system.prompt)
|
||||
Embed(PROFILER_FILES FontFixed src/font/FiraCode-Retina.ttf)
|
||||
Embed(PROFILER_FILES FontIcons src/font/Font\ Awesome\ 6\ Free-Solid-900.otf)
|
||||
Embed(PROFILER_FILES FontNormal src/font/Roboto-Regular.ttf)
|
||||
|
||||
set(INCLUDES "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(LIBS "")
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
#include "Fonts.hpp"
|
||||
#include "profiler/IconsFontAwesome6.h"
|
||||
#include "profiler/TracyEmbed.hpp"
|
||||
|
||||
#include "font/DroidSans.hpp"
|
||||
#include "font/FiraCodeRetina.hpp"
|
||||
#include "font/FontAwesomeSolid.hpp"
|
||||
#include "data/FontFixed.hpp"
|
||||
#include "data/FontIcons.hpp"
|
||||
#include "data/FontNormal.hpp"
|
||||
|
||||
ImFont* s_bigFont;
|
||||
ImFont* s_smallFont;
|
||||
@@ -39,20 +40,27 @@ void LoadFonts( float scale )
|
||||
|
||||
ImFontConfig configBasic;
|
||||
configBasic.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||
configBasic.FontDataOwnedByAtlas = false;
|
||||
ImFontConfig configMerge;
|
||||
configMerge.MergeMode = true;
|
||||
configMerge.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||
configMerge.FontDataOwnedByAtlas = false;
|
||||
ImFontConfig configFixed;
|
||||
configFixed.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||
configFixed.GlyphExtraAdvanceX = -1;
|
||||
configFixed.FontDataOwnedByAtlas = false;
|
||||
|
||||
auto fontFixed = Unembed( FontFixed );
|
||||
auto fontIcons = Unembed( FontIcons );
|
||||
auto fontNormal = Unembed( FontNormal );
|
||||
|
||||
io.Fonts->Clear();
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 15.0f * scale ), &configBasic, rangesBasic );
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 14.0f * scale ), &configMerge, rangesIcons );
|
||||
s_fixedWidth = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FiraCodeRetina_compressed_data, tracy::FiraCodeRetina_compressed_size, round( 15.0f * scale ), &configFixed, rangesFixed );
|
||||
s_bigFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 21.0f * scale ), &configBasic );
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF( tracy::FontAwesomeSolid_compressed_data, tracy::FontAwesomeSolid_compressed_size, round( 20.0f * scale ), &configMerge, rangesIcons );
|
||||
s_smallFont = io.Fonts->AddFontFromMemoryCompressedTTF( tracy::DroidSans_compressed_data, tracy::DroidSans_compressed_size, round( 10.0f * scale ), &configBasic );
|
||||
io.Fonts->AddFontFromMemoryTTF( (void*)fontNormal->data(), fontNormal->size(), round( 15.0f * scale ), &configBasic, rangesBasic );
|
||||
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 14.0f * scale ), &configMerge, rangesIcons );
|
||||
s_fixedWidth = io.Fonts->AddFontFromMemoryTTF( (void*)fontFixed->data(), fontFixed->size(), round( 15.0f * scale ), &configFixed, rangesFixed );
|
||||
s_bigFont = io.Fonts->AddFontFromMemoryTTF( (void*)fontNormal->data(), fontNormal->size(), round( 21.0f * scale ), &configBasic );
|
||||
io.Fonts->AddFontFromMemoryTTF( (void*)fontIcons->data(), fontIcons->size(), round( 20.0f * scale ), &configMerge, rangesIcons );
|
||||
s_smallFont = io.Fonts->AddFontFromMemoryTTF( (void*)fontNormal->data(), fontNormal->size(), round( 10.0f * scale ), &configBasic );
|
||||
|
||||
ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||
ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
BIN
profiler/src/font/FiraCode-Retina.ttf
Normal file
BIN
profiler/src/font/FiraCode-Retina.ttf
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
profiler/src/font/Font Awesome 6 Free-Solid-900.otf
Normal file
BIN
profiler/src/font/Font Awesome 6 Free-Solid-900.otf
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
profiler/src/font/Roboto-Regular.ttf
Normal file
BIN
profiler/src/font/Roboto-Regular.ttf
Normal file
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user