Skip to content

Commit d525dae

Browse files
committed
Font cleanup
1 parent a944db9 commit d525dae

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

inc/rprof_imgui.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@
335335

336336
uint64_t totalTime = _data->m_endtime - _data->m_startTime;
337337

338-
float barHeight = 15.0f;
338+
float barHeight = 18.0f;
339339
float bottom = 0.0f;
340340

341341
uint64_t currTime = rprofGetClock();
@@ -511,8 +511,9 @@
511511
float startX = frameStartX;
512512
float endX = frameStartX + endXpct * (frameEndX - frameStartX);
513513

514-
ImVec2 tl = ImVec2(startX, frameStartY);
515-
ImVec2 br = ImVec2(endX, frameStartY + barHeight);
514+
ImVec2 tl = ImVec2(startX, frameStartY);
515+
ImVec2 tlt = ImVec2(tl.x + 3, tl.y);
516+
ImVec2 br = ImVec2(endX, frameStartY + barHeight);
516517

517518
int colIdx = s_maxLevelColors - 1 - i;
518519
if (colIdx < 0) colIdx = 0;
@@ -532,19 +533,19 @@
532533

533534
draw_list->PushClipRect(tl, br, true);
534535
draw_list->AddRectFilled(tl, br, drawColor);
535-
draw_list->AddText(tl, IM_COL32(0, 0, 0, 255), cs.m_name);
536+
draw_list->AddText(tlt, IM_COL32(0, 0, 0, 255), cs.m_name);
536537
draw_list->PopClipRect();
537538

538539
ImVec2 htl = ImVec2(endX, frameStartY);
539540
draw_list->PushClipRect(htl, brE, true);
540-
draw_list->AddText(tl, IM_COL32(128, 128, 128, 255), cs.m_name);
541+
draw_list->AddText(tlt, IM_COL32(128, 128, 128, 255), cs.m_name);
541542
draw_list->PopClipRect();
542543

543544
if (hoverRow && ImGui::IsWindowHovered())
544545
{
545546
draw_list->PushClipRect(htl, brE, true);
546547
draw_list->AddRectFilled(htl, brE, IM_COL32(64,64,64,255));
547-
draw_list->AddText(tl, IM_COL32(0, 0, 0, 255), cs.m_name);
548+
draw_list->AddText(tlt, IM_COL32(0, 0, 0, 255), cs.m_name);
548549
draw_list->PopClipRect();
549550

550551
ImGui::BeginTooltip();

tools/rprof_inspector/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ INCLUDES = -I../../3rd/imgui -I../../3rd/implot
1919
#LIBS = -lGL
2020
LIBS = -lGL-webgl2-full_es3-getprocaddr
2121
WEBGL_VER = -s USE_WEBGL2=1 -s USE_GLFW=3 -s FULL_ES3=1
22-
FILE_SYSTEM = -s FORCE_FILESYSTEM=1 -s ASYNCIFY=1 --memory-init-file 0 -DIMGUI_DISABLE_DEBUG_TOOLS
22+
FILE_SYSTEM = -s FORCE_FILESYSTEM=1 -s ASYNCIFY=1 --memory-init-file 0 -DIMGUI_DISABLE_DEBUG_TOOLS
2323
USE_WASM = -s WASM=1
2424

2525
PROJECTS := gui

tools/rprof_inspector/main.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <GLFW/glfw3.h>
1717
#include <GLES3/gl3.h>
1818
#include "imgui.h"
19+
#include "misc/freetype/imgui_freetype.h"
1920
#include "backends/imgui_impl_glfw.h"
2021
#include "backends/imgui_impl_opengl3.h"
2122
#include "implot.h"
@@ -215,17 +216,10 @@ int init()
215216

216217
ImGui::StyleColorsDark();
217218

218-
ImFontConfig fontCfg;
219-
fontCfg.FontDataOwnedByAtlas = false;
220-
fontCfg.OversampleH = 3;
221-
fontCfg.OversampleV = 1;
222-
fontCfg.RasterizerMultiply = 1.2;
223-
fontCfg.PixelSnapH = true;
224-
io.Fonts->AddFontDefault(&fontCfg);
219+
io.Fonts->AddFontDefault();
225220

226221
g_imgui = ImGui::GetCurrentContext();
227-
228-
g_plot = ImPlot::CreateContext();
222+
g_plot = ImPlot::CreateContext();
229223

230224
glfwSetMouseButtonCallback(g_window, ImGui_ImplGlfw_MouseButtonCallback);
231225
glfwSetScrollCallback(g_window, ImGui_ImplGlfw_ScrollCallback);
@@ -343,8 +337,8 @@ void loop()
343337

344338
ImGui::SetCurrentContext(g_imgui);
345339

346-
ImGui_ImplOpenGL3_NewFrame();
347340
ImGui_ImplGlfw_NewFrame();
341+
ImGui_ImplOpenGL3_NewFrame();
348342
ImGui::NewFrame();
349343

350344
if (g_multi != -1)

0 commit comments

Comments
 (0)