diff options
| author | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-08 22:08:07 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-08 22:08:07 +0100 |
| commit | 6555d97f2eaf5b3829543624f6b0a3394715c71b (patch) | |
| tree | c0b2d6abd7e402b32ab2e42088db6da4337c0364 /src/main_linux.cpp | |
| parent | 0d70098dd5b704f2953c63f0c827b46b11935b81 (diff) | |
setup window work
Diffstat (limited to 'src/main_linux.cpp')
| -rw-r--r-- | src/main_linux.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main_linux.cpp b/src/main_linux.cpp index e605659..a7619b0 100644 --- a/src/main_linux.cpp +++ b/src/main_linux.cpp @@ -26,6 +26,8 @@ #include "administration_writer.hpp" #include "administration_reader.hpp" +#include "IconFontCppHeaders/IconsFontAwesome5.h" + // [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers. // To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma. // Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio. @@ -61,8 +63,8 @@ static void _create_window(bool is_setup_window) if (is_setup_window) { glfwWindowHint(GLFW_RESIZABLE, false); - windowWidth = (int)(800 * main_scale); - windowHeight = (int)(500 * main_scale); + windowWidth = (int)(500 * main_scale); + windowHeight = (int)(400 * main_scale); } else { glfwWindowHint(GLFW_RESIZABLE, true); @@ -93,10 +95,24 @@ static void _create_window(bool is_setup_window) ImGui_ImplGlfw_InitForOpenGL(window, true); ImGui_ImplOpenGL2_Init(); + io.Fonts->Clear(); style.FontSizeBase = 18.0f; - io.Fonts->AddFontFromFileTTF("/home/aldrik/Projects/open-books/build/Roboto-Regular.ttf"); - ui::fontBold = io.Fonts->AddFontFromFileTTF("/home/aldrik/Projects/open-books/build/Roboto-Bold.ttf"); + float iconFontSize = 10.0f; + + static ImWchar icon_range[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; + + ImFontConfig icons_config; + icons_config.GlyphMinAdvanceX = iconFontSize; + io.Fonts->AddFontFromFileTTF( "/home/aldrik/Projects/open-books/build/" FONT_ICON_FILE_NAME_FAS, iconFontSize, &icons_config, icon_range); + + ImFontConfig cfg1; + cfg1.MergeMode = true; + io.Fonts->AddFontFromFileTTF("/home/aldrik/Projects/open-books/build/Roboto-Regular.ttf", 0, &cfg1); + + ui::fontBold = io.Fonts->AddFontFromFileTTF("/home/aldrik/Projects/open-books/build/Roboto-Bold.ttf", 0); ui::fontBig = io.Fonts->AddFontFromFileTTF("/home/aldrik/Projects/open-books/build/Roboto-Bold.ttf", 30); + + io.Fonts->Build(); } // Main code |
