getText method
Implementation
String getText([int? from, int? to]) {
if (from == null || from < 0) {
from = 0;
}
if (to == null || to > _length) {
to = _length;
}
if (from > 0 &&
from < _length &&
getWidth(from) == 0 &&
getWidth(from - 1) == 2) {
from--;
}
if (to > 0 && to < _length && getWidth(to) == 0 && getWidth(to - 1) == 2) {
to++;
}
final builder = StringBuffer();
for (var i = from; i < to; i++) {
final codePoint = getCodePoint(i);
final width = getWidth(i);
if (codePoint != 0 && i + width <= to) {
builder.writeCharCode(codePoint);
final combining = _combiningCharacters[i];
if (combining != null) {
builder.write(combining);
}
}
}
return builder.toString();
}