From f77fcc0e8c4e584e66b50299295d55726da38e0d Mon Sep 17 00:00:00 2001 From: Aaron Static Date: Thu, 4 Nov 2021 23:22:51 +1100 Subject: [PATCH] Fonts need to be loaded locally in v2 --- src/Braids.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Braids.cpp b/src/Braids.cpp index 1d2fbc8..425eb93 100644 --- a/src/Braids.cpp +++ b/src/Braids.cpp @@ -253,10 +253,9 @@ static const std::vector SHAPE_INFOS = { struct BraidsDisplay : TransparentWidget { Braids* module; - std::shared_ptr font; BraidsDisplay() { - font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf")); + } void draw(const DrawArgs& args) override { @@ -285,7 +284,11 @@ struct BraidsDisplay : TransparentWidget { // Background of all segments nvgText(args.vg, textPos.x, textPos.y, "~~~~", NULL); nvgFillColor(args.vg, textColor); - nvgText(args.vg, textPos.x, textPos.y, SHAPE_INFOS[shape].code.c_str(), NULL); + + std::shared_ptr font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf")); + if(font){ + nvgText(args.vg, textPos.x, textPos.y, SHAPE_INFOS[shape].code.c_str(), NULL); + } } };