isMostlyRtl static method

bool isMostlyRtl(
  1. String text
)

Strong direction of a paragraph by majority vote of strong characters.

Implementation

static bool isMostlyRtl(String text) {
  int rtl = 0;
  int ltr = 0;
  for (final int code in text.runes) {
    if (isRtlCode(code) && !isDigitCode(code) && !isCombiningMark(code)) {
      rtl++;
    } else if (isStrongLtrCode(code)) {
      ltr++;
    }
  }
  return rtl > ltr;
}