MCPcopy Create free account
hub / github.com/Tom94/tev / getCaptionWidth

Method getCaptionWidth

src/ImageButton.cpp:130–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128};
129
130float ImageButton::getCaptionWidth(NVGcontext* ctx, size_t cutoff) const {
131 const auto pieces = getCaptionPieces(cutoff);
132
133 nvgFontSize(ctx, m_font_size);
134
135 float totalSize = 0;
136 for (size_t i = 0; i < 3; ++i) {
137 if (pieces[i].empty()) {
138 continue;
139 }
140
141 nvgFontFace(ctx, i == 1 ? "sans-bold" : "sans");
142 totalSize += nvgTextBounds(ctx, 0, 0, pieces[i].data(), pieces[i].data() + pieces[i].size(), nullptr);
143 }
144
145 return totalSize;
146}
147
148void ImageButton::draw(NVGcontext* ctx) {
149 Widget::draw(ctx);

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected