]> code.bitgloo.com Git - clyne/stmdspgui.git/commitdiff
add mono font, swap sans to lighter
authorClyne Sullivan <clyne@bitgloo.com>
Mon, 9 Aug 2021 02:57:26 +0000 (22:57 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Mon, 9 Aug 2021 02:57:26 +0000 (22:57 -0400)
fonts/Roboto-Regular.ttf [new file with mode: 0644]
fonts/RobotoMono-Regular.ttf [new file with mode: 0644]
source/gui.cpp
source/main.cpp

diff --git a/fonts/Roboto-Regular.ttf b/fonts/Roboto-Regular.ttf
new file mode 100644 (file)
index 0000000..3d6861b
Binary files /dev/null and b/fonts/Roboto-Regular.ttf differ
diff --git a/fonts/RobotoMono-Regular.ttf b/fonts/RobotoMono-Regular.ttf
new file mode 100644 (file)
index 0000000..7c4ce36
Binary files /dev/null and b/fonts/RobotoMono-Regular.ttf differ
index 15beb90d0cac8af9395798e45bdaf87fc94c66fe..fad451e99a49e4f42e92db06947c7c3d8e186122 100644 (file)
@@ -18,7 +18,8 @@
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_opengl.h>
 
-ImFont *font = nullptr;
+ImFont *fontSans = nullptr;
+ImFont *fontMono = nullptr;
 static ImGuiIO *io = nullptr;
 static SDL_Window *window = nullptr;
 static decltype(SDL_GL_CreateContext(nullptr)) gl_context;
@@ -49,7 +50,8 @@ bool guiInitialize()
     ImGui::CreateContext();
     io = &ImGui::GetIO();
     io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
-    font = io->Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 20);
+    fontSans = io->Fonts->AddFontFromFileTTF("fonts/Roboto-Regular.ttf", 20);
+    fontMono = io->Fonts->AddFontFromFileTTF("fonts/RobotoMono-Regular.ttf", 20);
     ImGui::StyleColorsLight();
 
     ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
index dc5f789b00380132b89bc38b79276ffbc99aac58..8c87081332090617d85c8dc0a2ef4c5194d729dd 100644 (file)
@@ -20,7 +20,8 @@
 #include <string>
 
 // Externs
-extern ImFont *font;
+extern ImFont *fontSans;
+extern ImFont *fontMono;
 
 extern bool guiInitialize();
 extern void guiHandleEvents(bool& done);
@@ -79,20 +80,22 @@ int main(int, char **)
         ImGui::SetNextWindowSize({WINDOW_WIDTH, WINDOW_HEIGHT - 22 - 200});
         ImGui::Begin("main", nullptr,
                      ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration);
-        ImGui::PushFont(font);
 
         // Render main controls (order is important).
+        ImGui::PushFont(fontSans);
         codeRenderToolbar();
         deviceRenderToolbar();
         fileRenderDialog();
-        codeRenderWidgets();
+        ImGui::PopFont();
 
+        ImGui::PushFont(fontMono);
+        codeRenderWidgets();
         ImGui::SetNextWindowPos({0, WINDOW_HEIGHT - 200});
         ImGui::SetNextWindowSize({WINDOW_WIDTH, 200});
         logView.Draw("log", nullptr, ImGuiWindowFlags_NoDecoration);
+        ImGui::PopFont();
 
         // Finish main view rendering.
-        ImGui::PopFont();
         ImGui::End();
 
         // Draw everything to the screen.