MCPcopy Create free account
hub / github.com/antvis/F2Native / AdaptTextFontSize

Method AdaptTextFontSize

core/graphics/shape/Text.cpp:131–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void xg::shape::Text::AdaptTextFontSize(canvas::CanvasContext &context,
132 int padding, int minSize, int maxWidth) {
133 if (minSize < 1 || fontSize_ < 1 || maxWidth < 1) {
134 return;
135 }
136 for (int i = fontSize_; i >= minSize; i--) {
137 SetTextFontSize(i);
138 float textWidth = GetTextWidth(context);
139 if (maxWidth - textWidth - padding > 0) {
140 break;
141 }
142 }
143}

Callers 1

InitAxisMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected