From 3a2731a832cdfecd46b20bfee144ba1d50924686 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 6 Jun 2021 18:57:17 -0400 Subject: [PATCH] Load Scope font every frame instead of in constructor. --- src/Scope.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Scope.cpp b/src/Scope.cpp index 77f95eb..0658e20 100644 --- a/src/Scope.cpp +++ b/src/Scope.cpp @@ -180,7 +180,7 @@ struct Scope : Module { struct ScopeDisplay : TransparentWidget { Scope* module; int statsFrame = 0; - std::shared_ptr font; + std::string fontPath; struct Stats { float vpp = 0.f; @@ -202,7 +202,7 @@ struct ScopeDisplay : TransparentWidget { Stats statsX, statsY; ScopeDisplay() { - font = APP->window->loadFont(asset::plugin(pluginInstance, "res/sudo/Sudo.ttf")); + fontPath = asset::plugin(pluginInstance, "res/sudo/Sudo.ttf"); } void drawWaveform(const DrawArgs& args, float* bufferX, float offsetX, float gainX, float* bufferY, float offsetY, float gainY) { @@ -265,6 +265,7 @@ struct ScopeDisplay : TransparentWidget { } nvgFill(args.vg); + std::shared_ptr font = APP->window->loadFont(fontPath); nvgFontSize(args.vg, 9); nvgFontFaceId(args.vg, font->handle); nvgFillColor(args.vg, nvgRGBA(0x1e, 0x28, 0x2b, 0xff)); @@ -273,6 +274,7 @@ struct ScopeDisplay : TransparentWidget { } void drawStats(const DrawArgs& args, Vec pos, const char* title, Stats* stats) { + std::shared_ptr font = APP->window->loadFont(fontPath); nvgFontSize(args.vg, 13); nvgFontFaceId(args.vg, font->handle); nvgTextLetterSpacing(args.vg, -2);