emToFixed function

int emToFixed(
  1. double v
)

Fixed-point encode: em coordinate -> biased u16 (see library header).

Implementation

int emToFixed(double v) {
  final f = (v * 8192).round() + 32768;
  return f < 0 ? 0 : (f > 0xFFFF ? 0xFFFF : f);
}