resolveImplicitTypes method Null safety

void resolveImplicitTypes(
  1. int start,
  2. int limit,
  3. int level
)

3.3.5 Resolving Implicit Levels

Implementation

void resolveImplicitTypes(int start, int limit, int level) {
  // I1. For all characters with an even (left-to-right) embedding direction, those of type R go up one level and those of type AN or EN go up two levels.
  // I2. For all characters with an odd (right-to-left) embedding direction, those of type L, EN or AN go up one level.

  if ((level & 1) == 0) // even level
  {
    for (int i = start; i < limit; ++i) {
      _BidiCharacterType t = _textData[i]._ct;
      // Rule I1.
      if (t == _BidiCharacterType.R) {
        _textData[i]._el += 1;
      } else if (t == _BidiCharacterType.AN || t == _BidiCharacterType.EN) {
        _textData[i]._el += 2;
      }
    }
  } else // odd level
  {
    for (int i = start; i < limit; ++i) {
      _BidiCharacterType t = _textData[i]._ct;
      // Rule I2.
      if (t == _BidiCharacterType.L ||
          t == _BidiCharacterType.AN ||
          t == _BidiCharacterType.EN) _textData[i]._el += 1;
    }
  }
}