isZeroWidthCodePoint function

bool isZeroWidthCodePoint(
  1. int codePoint
)

Returns true if the given code point occupies 0 terminal cells.

Implementation

bool isZeroWidthCodePoint(int codePoint) {
  if (codePoint <= 0x1F) return codePoint >= 0;
  if (codePoint < 0x7F) return false;
  if (codePoint <= 0x9F) return true;
  if (codePoint >= 0x0300 && codePoint <= 0x036F) return true;
  var low = 0;
  var high = _zeroWidthRangeStarts.length - 1;
  while (low <= high) {
    final mid = (low + high) >> 1;
    if (codePoint < _zeroWidthRangeStarts[mid]) {
      high = mid - 1;
    } else if (codePoint > _zeroWidthRangeEnds[mid]) {
      low = mid + 1;
    } else {
      return true;
    }
  }
  return false;
}