advance method

  1. @override
double advance(
  1. int glyphId
)
override

Implementation

@override
double advance(int glyphId) {
  final UDocCursor? hmtx = _table("hmtx");
  if (hmtx == null || _numberOfHMetrics <= 0) return _unitsPerEm / 2;
  final int index = glyphId < _numberOfHMetrics ? glyphId : _numberOfHMetrics - 1;
  final int offset = index * 4;
  if (hmtx.remaining < offset + 2) return _unitsPerEm / 2;
  hmtx.skip(offset);
  return hmtx.u16().toDouble();
}