I’m using the SimpleControls example as a boiler plate.
First thing was that I wanted to change the font.
In config.h
I changed line 54
from #define ROBOTO_FN "Roboto-Regular.ttf"
to __ #define WORKSANS_FN "WorkSans-Regular.ttf"
In SimpleControls.cpp
I changed line 82
from pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN);
to __ pGraphics->LoadFont("Roboto-Regular", WORKSANS_FN);
I also put the font file WorkSans-Regular.ttf
into the ressources/fonts folder and removed the Roboto-Regular.ttf
file.
Result: It works!
However, there is still one mention of Roboto-Regular to change. When editing line 82 in SimpleControls.cpp
like so:
pGraphics->LoadFont("WorkSans-Regular", WORKSANS_FN);
It is compiling OK, but on runtime it will abort like this:
../iPlug2/IGraphics/Drawing/IGraphicsNanoVG.cpp:599: void iplug::igraphics::IGraphicsNanoVG::PrepareAndMeasureText(const iplug::igraphics::IText&, const char*, iplug::igraphics::IRECT&, double&, double&) const: Assertion `nvgFindFont(mVG, text.mFont) != -1 && "No font found - did you forget to load it?"' failed.
Aborted (core dumped)
According to the reference the first parameter in LoadFont is the “fontID”.