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

Method DrawString

Source/OpenFrameworksPort.cpp:791–816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789}
790
791void RetinaTrueTypeFont::DrawString(std::string str, float size, float x, float y)
792{
793 if (!mLoaded)
794 return;
795
796 nvgFontFaceId(gNanoVG, mFontHandle);
797 nvgFontSize(gNanoVG, size);
798
799
800 if (ofIsStringInString(str, "\n") == false)
801 {
802 nvgText(gNanoVG, x, y, str.c_str(), nullptr);
803 }
804 else
805 {
806 std::vector<std::string> lines = ofSplitString(str, "\n");
807 float bounds[4];
808 nvgTextBounds(gNanoVG, 0, 0, str.c_str(), nullptr, bounds);
809 float lineHeight = bounds[3] - bounds[1];
810 for (int i = 0; i < lines.size(); ++i)
811 {
812 nvgText(gNanoVG, x, y, lines[i].c_str(), nullptr);
813 y += lineHeight;
814 }
815 }
816}
817
818ofRectangle RetinaTrueTypeFont::DrawStringWrap(std::string str, float size, float x, float y, float width)
819{

Callers 15

RenderMethod · 0.80
RenderOverlayMethod · 0.80
DrawSyntaxHighlightMethod · 0.80
DrawModuleMethod · 0.80
DrawModuleMethod · 0.80
DrawModuleMethod · 0.80
DrawModuleUnclippedMethod · 0.80
DrawModuleMethod · 0.80
DrawMethod · 0.80
RenderMethod · 0.80
DrawConsoleMethod · 0.80
DrawTextNormalFunction · 0.80

Calls 7

nvgFontFaceIdFunction · 0.85
nvgFontSizeFunction · 0.85
ofIsStringInStringFunction · 0.85
nvgTextFunction · 0.85
ofSplitStringFunction · 0.85
nvgTextBoundsFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected