comicMarkedPitch function

double? comicMarkedPitch(
  1. String words
)

The least line pitch, as a multiple of the size, at which lines of words in the look's lettering clear each other: the farthest any of its glyphs reaches above the line, over the farthest any reaches below it, and a hair between. Null when no letter of words reaches past a plain capital, as in English, whose lettering keeps its tight leading. Bangers' marks stand above its capitals (an acute 1.12 times the size, a stacked Vietnamese tone 1.39), so at the lettering's 0.95 they cut into the line above. As Material gives a tall script more room, a language whose marks reach higher gets more, the whole paragraph alike so its lines stay evenly spaced.

Implementation

double? comicMarkedPitch(String words) {
  var marked = false;
  var top = comicPlainReach[0], bottom = comicPlainReach[1];
  // The parts set the lettering in capitals; a lowercase letter's marks are measured too.
  for (final text in [words, words.toUpperCase()]) {
    for (final rune in text.runes) {
      final letter = _letterReach[rune];
      final reach = letter ?? _signReach[rune];
      if (reach == null) continue;
      marked = marked || letter != null;
      top = math.max(top, reach.$1);
      bottom = math.max(bottom, reach.$2);
    }
  }
  return marked ? (top + bottom) / 100 + _hair : null;
}