recalculateMetrics method
Implementation
void recalculateMetrics(ChantContext ctxt, [bool resetNewLines = true]) {
if (resetNewLines) {
for (final span in spans) {
span.xOffset = null;
if (span.newLine > 0) {
span.newLine = 0;
span.text = " ${span.text}";
}
}
}
bounds = bounds.copyWith(x: 0, y: 0);
origin = core.Point(0, origin.y);
final bbox = ctxt.textMeasurer.measureTextBounds(this, ctxt);
bounds = bounds.copyWith(width: bbox.width, height: bbox.height);
origin = core.Point(-bbox.x, -bbox.y);
numLines = spans.fold(1, (acc, s) => acc + s.newLine);
}