computeLineMetrics method
Returns the full list of LineMetrics that describe in detail the various metrics of each laid out line.
Not valid until after layout.
This can potentially return a large amount of data, so it is not recommended to repeatedly call this. Instead, cache the results.
Implementation
List<LineMetrics> computeLineMetrics() {
final Float64List encoded = _computeLineMetrics();
final int count = encoded.length ~/ 9;
int position = 0;
final List<LineMetrics> metrics = List<LineMetrics>(count);
for (int index = 0; index < metrics.length; index += 1) {
metrics[index] = LineMetrics(
hardBreak: encoded[position++] != 0,
ascent: encoded[position++],
descent: encoded[position++],
unscaledAscent: encoded[position++],
height: encoded[position++],
width: encoded[position++],
left: encoded[position++],
baseline: encoded[position++],
lineNumber: encoded[position++].toInt(),
);
}
return metrics;
}