Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `font_scale_media_player` | Change size of media player text relative to `font_size` |
| `font_size=` | Customizable font size. Default is `24` |
| `font_size_secondary=` | Customizable font size for secondary metrics. Default is `0.55 * font_size`. |
| `font_size_small=` | Customizable font size for small text (like units). Default is `0.55 * font_size`. |
| `font_size_text=` | Customizable font size for other text like media metadata. Default is `24` |
| `fps_color_change` | Change the FPS text color depepending on the FPS value |
| `fps_color=` | Choose the colors that the fps changes to when `fps_color_change` is enabled. Corresponds with fps_value. Default is `b22222,fdfd09,39f900` |
Expand Down
12 changes: 8 additions & 4 deletions src/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ void create_fonts(ImFontAtlas* font_atlas, const overlay_params& params, ImFont*
if (font_size_secondary > font_size || font_size_secondary < FLT_EPSILON)
font_size_secondary = font_size;

float font_size_small = params.font_size_small;
if (font_size_small > font_size || font_size_small < FLT_EPSILON)
font_size_small = font_size;

static const ImWchar default_range[] =
{
0x0020, 0x00FF, // Basic Latin + Latin Supplement
Expand Down Expand Up @@ -80,8 +84,8 @@ void create_fonts(ImFontAtlas* font_atlas, const overlay_params& params, ImFont*
if (params.no_small_font)
small_font = font_atlas->Fonts[0];
else {
small_font = font_atlas->AddFontFromFileTTF(params.font_file.c_str(), font_size * 0.55f, nullptr, default_range);
font_atlas->AddFontFromMemoryCompressedBase85TTF(forkawesome_compressed_data_base85, font_size * 0.55f, &config, icon_ranges);
small_font = font_atlas->AddFontFromFileTTF(params.font_file.c_str(), font_size_small, nullptr, default_range);
font_atlas->AddFontFromMemoryCompressedBase85TTF(forkawesome_compressed_data_base85, font_size_small, &config, icon_ranges);
}
if (secondary_same_size) {
secondary_font = font_atlas->Fonts[0];
Expand All @@ -96,8 +100,8 @@ void create_fonts(ImFontAtlas* font_atlas, const overlay_params& params, ImFont*
if (params.no_small_font)
small_font = font_atlas->Fonts[0];
else {
small_font = font_atlas->AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_size * 0.55f, nullptr, default_range);
font_atlas->AddFontFromMemoryCompressedBase85TTF(forkawesome_compressed_data_base85, font_size * 0.55f, &config, icon_ranges);
small_font = font_atlas->AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_size_small, nullptr, default_range);
font_atlas->AddFontFromMemoryCompressedBase85TTF(forkawesome_compressed_data_base85, font_size_small, &config, icon_ranges);
}
if (secondary_same_size) {
secondary_font = font_atlas->Fonts[0];
Expand Down
8 changes: 7 additions & 1 deletion src/overlay_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ parse_ftrace(const char *str) {
#define parse_log_interval(s) parse_unsigned(s)
#define parse_font_size(s) parse_float(s)
#define parse_font_size_secondary(s) parse_float(s)
#define parse_font_size_small(s) parse_float(s)
#define parse_font_size_text(s) parse_float(s)
#define parse_font_scale(s) parse_float(s)
#define parse_background_alpha(s) parse_float(s)
Expand Down Expand Up @@ -1049,14 +1050,19 @@ parse_overlay_config(struct overlay_params *params,
if (!params->font_size_secondary)
params->font_size_secondary = params->font_size * 0.55f;

// If small font size not set, compute it from main font_size
if (!params->font_size_small)
params->font_size_small = params->font_size * 0.55f;

params->font_params_hash = get_hash(params->font_size,
params->font_size_text,
params->no_small_font,
params->font_file,
params->font_file_text,
params->font_glyph_ranges,
params->font_scale,
params->font_size_secondary
params->font_size_secondary,
params->font_size_small
);

// check if user specified an env for fps limiter instead
Expand Down
3 changes: 2 additions & 1 deletion src/overlay_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ struct Tracepoint;
OVERLAY_PARAM_CUSTOM(font_size) \
OVERLAY_PARAM_CUSTOM(font_size_text) \
OVERLAY_PARAM_CUSTOM(font_size_secondary) \
OVERLAY_PARAM_CUSTOM(font_size_small) \
OVERLAY_PARAM_CUSTOM(font_scale) \
OVERLAY_PARAM_CUSTOM(font_scale_media_player) \
OVERLAY_PARAM_CUSTOM(position) \
Expand Down Expand Up @@ -312,7 +313,7 @@ struct overlay_params {
unsigned table_columns;
bool no_small_font;
float font_size, font_scale;
float font_size_text, font_size_secondary;
float font_size_text, font_size_secondary, font_size_small;
float font_scale_media_player;
float background_alpha, alpha;
float cellpadding_y;
Expand Down
Loading