MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawStringWrap

Method DrawStringWrap

Source/OpenFrameworksPort.cpp:818–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818ofRectangle RetinaTrueTypeFont::DrawStringWrap(std::string str, float size, float x, float y, float width)
819{
820 if (!mLoaded)
821 return ofRectangle();
822
823 TheSynth->LockRender(true);
824 nvgFontFaceId(gNanoVG, mFontHandle);
825 nvgFontSize(gNanoVG, size);
826 nvgTextBox(gNanoVG, x, y, width, str.c_str(), nullptr);
827 float bounds[4];
828 nvgTextBoxBounds(gNanoVG, x, y, width, str.c_str(), nullptr, bounds);
829 ofRectangle rect(bounds[0], bounds[1], bounds[2] - bounds[0], bounds[3] - bounds[1]);
830 TheSynth->LockRender(false);
831 return rect;
832}
833
834float RetinaTrueTypeFont::GetStringWidth(std::string str, float size)
835{

Callers 3

DrawModuleMethod · 0.80
DrawModuleMethod · 0.80
DrawMethod · 0.80

Calls 6

ofRectangleClass · 0.85
nvgFontFaceIdFunction · 0.85
nvgFontSizeFunction · 0.85
nvgTextBoxFunction · 0.85
nvgTextBoxBoundsFunction · 0.85
LockRenderMethod · 0.80

Tested by

no test coverage detected