diff --git a/RenderingManager.cpp b/RenderingManager.cpp index e35a984..85a2438 100644 --- a/RenderingManager.cpp +++ b/RenderingManager.cpp @@ -358,6 +358,28 @@ glm::vec3 Rendering::unProject(glm::vec2 screen_coordinate, glm::mat4 modelview) float Rendering::Width() { return main_window_attributes_.viewport.x; } float Rendering::Height() { return main_window_attributes_.viewport.y; } +float Rendering::MonitorWidth() +{ + GLFWmonitor *monitor = glfwGetWindowMonitor (main_window_); + if (!monitor) + monitor = glfwGetPrimaryMonitor (); + int xpos, ypos, width, height; + glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height); + + return width; +} + +float Rendering::MonitorHeight() +{ + GLFWmonitor *monitor = glfwGetWindowMonitor (main_window_); + if (!monitor) + monitor = glfwGetPrimaryMonitor (); + int xpos, ypos, width, height; + glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height); + + return height; +} + void Rendering::ToggleFullscreen() { // if in fullscreen mode diff --git a/RenderingManager.h b/RenderingManager.h index d5d2d86..bd342a8 100644 --- a/RenderingManager.h +++ b/RenderingManager.h @@ -84,6 +84,9 @@ public: // for opengl pipeline in gstreamer void LinkPipeline( GstPipeline *pipeline ); + float MonitorWidth(); + float MonitorHeight(); + private: // loop update to begin new frame diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 8d02b1e..1de928b 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -154,8 +154,8 @@ bool UserInterface::Init() ImGuiToolkit::SetAccentColor(static_cast(Settings::application.accent_color)); // Load Fonts (using resource manager, NB: a temporary copy of the raw data is necessary) - int base_font_size = int ( Rendering::manager().Height() / 90.f ); - Log::Info("Base font size %d", base_font_size); + int base_font_size = int ( Rendering::manager().MonitorHeight() / 90.f ); + Log::Info("Base font size %d (%.1f)", base_font_size, Rendering::manager().MonitorHeight()); ImGuiToolkit::SetFont(ImGuiToolkit::FONT_DEFAULT, "Roboto-Regular", base_font_size); ImGuiToolkit::SetFont(ImGuiToolkit::FONT_BOLD, "Roboto-Bold", base_font_size); ImGuiToolkit::SetFont(ImGuiToolkit::FONT_ITALIC, "Roboto-Italic", base_font_size);