added MANGOHUD_FONT to params as font_file

pull/58/head
FlightlessMango 4 years ago
parent d1bdf71580
commit 8641392ca7

@ -1868,11 +1868,10 @@ static void setup_swapchain_data_pipeline(struct swapchain_data *data)
if (!font_size)
font_size = 24;
const char* mangohud_font = getenv("MANGOHUD_FONT");
// ImGui takes ownership of the data, no need to free it
if (mangohud_font && file_exists(mangohud_font)) {
data->font = io.Fonts->AddFontFromFileTTF(mangohud_font, font_size);
data->sw_stats.font1 = io.Fonts->AddFontFromFileTTF(mangohud_font, font_size * 0.55f);
if (!device_data->instance->params.font_file.empty() && file_exists(device_data->instance->params.font_file)) {
data->font = io.Fonts->AddFontFromFileTTF(device_data->instance->params.font_file.c_str(), font_size);
data->sw_stats.font1 = io.Fonts->AddFontFromFileTTF(device_data->instance->params.font_file.c_str(), font_size * 0.55f);
} else {
ImFontConfig font_cfg = ImFontConfig();
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();

@ -156,6 +156,7 @@ parse_str(const char *str)
#define parse_offset_y(s) parse_unsigned(s)
#define parse_time_format(s) parse_str(s)
#define parse_output_file(s) parse_str(s)
#define parse_font_file(s) parse_str(s)
#define parse_io_read(s) parse_unsigned(s)
#define parse_io_write(s) parse_unsigned(s)

@ -64,6 +64,7 @@ extern "C" {
OVERLAY_PARAM_BOOL(gpu_core_clock) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_file) \
OVERLAY_PARAM_CUSTOM(font_file) \
OVERLAY_PARAM_CUSTOM(position) \
OVERLAY_PARAM_CUSTOM(width) \
OVERLAY_PARAM_CUSTOM(height) \
@ -135,7 +136,7 @@ struct overlay_params {
KeySym toggle_hud;
KeySym toggle_logging;
KeySym reload_cfg;
std::string time_format, output_file;
std::string time_format, output_file, font_file;
};
const extern char *overlay_param_names[];

Loading…
Cancel
Save