measureStringSpecial method

SizeF measureStringSpecial(
  1. String strValue,
  2. Font font
)

Measures the specified string in special way (as close as possible to MS Excel).

Implementation

SizeF measureStringSpecial(String strValue, Font font) {
  final SizeF result = measureString(strValue, font);

  double originalHeight = result.fontHeight;
  final Map<double, double>? keyValuePairs = _fontsHeight[font.name];
  double fontHeight;
  if (keyValuePairs != null && keyValuePairs[font.size] != null) {
    fontHeight = keyValuePairs[font.size]!;
    originalHeight = convertUnits(fontHeight, 6, 5) *
        ((strValue.length - strValue.replaceAll('\n', '').length) + 1);
  }
  return SizeF(result.fontWidth, originalHeight);
}