cleanup font size

This commit is contained in:
brunoherbelin
2020-05-11 13:52:02 +02:00
parent 91020f5180
commit 1e715267da
3 changed files with 6 additions and 5 deletions

View File

@@ -705,8 +705,8 @@ void ImGuiToolkit::SetFont(ImGuiToolkit::font_style style, const std::string &tt
ImFontConfig font_config;
fontname.copy(font_config.Name, 40);
font_config.FontDataOwnedByAtlas = false; // data will be copied in font atlas
font_config.OversampleH = 7;
font_config.OversampleV = 3;
font_config.OversampleH = 5;
font_config.OversampleV = 5;
// read font in Resource manager
size_t data_size = 0;

View File

@@ -376,6 +376,7 @@ float Rendering::MonitorHeight()
GLFWmonitor *monitor = glfwGetWindowMonitor (main_window_);
if (!monitor)
monitor = glfwGetPrimaryMonitor ();
// TODO : detect in which monitor is the main window and return the height for that monitor
int xpos, ypos, width, height;
glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height);

View File

@@ -153,8 +153,9 @@ bool UserInterface::Init()
// Setup Dear ImGui style
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
// Load Fonts (using resource manager, NB: a temporary copy of the raw data is necessary)
// Estalish the base size from the resolution of the monitor
float base_font_size = (Rendering::manager().MonitorHeight() * Rendering::manager().DPIScale()) / 100.f ;
// Load Fonts (using resource manager, NB: a temporary copy of the raw data is necessary)
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_DEFAULT, "Roboto-Regular", int(base_font_size) );
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_BOLD, "Roboto-Bold", int(base_font_size) );
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_ITALIC, "Roboto-Italic", int(base_font_size) );
@@ -164,8 +165,7 @@ bool UserInterface::Init()
// info
Log::Info("Monitor (%.1f,%.1f)", Rendering::manager().MonitorWidth(), Rendering::manager().MonitorHeight());
Log::Info("DPI Scale %.1f", Rendering::manager().DPIScale());
Log::Info("Font size %.1f", base_font_size);
Log::Info("Font size %df", int(base_font_size) );
// Style
ImGuiStyle& style = ImGui::GetStyle();