Glyph constructor

Glyph(
  1. String char, {
  2. required double left,
  3. required double top,
  4. double? width,
  5. double? height,
  6. double? srcLeft,
  7. double? srcTop,
  8. double? srcRight,
  9. double? srcBottom,
})

Implementation

Glyph(
  this.char, {
  required this.left,
  required this.top,
  double? width,
  double? height,
  double? srcLeft,
  double? srcTop,
  double? srcRight,
  double? srcBottom,
})  : assert((width ?? 0) >= 0, 'The `width` parameter cannot be negative'),
      assert((height ?? 0) >= 0, 'The `height` parameter cannot be negative'),
      assert(
        (srcLeft == null &&
                srcTop == null &&
                srcRight == null &&
                srcBottom == null) ||
            (srcLeft != null &&
                srcTop != null &&
                srcRight != null &&
                srcBottom != null),
        'Either all or none of parameters `srcLeft`, `srcTop`, `srcRight` '
        'and `srcBottom` must be specified',
      ),
      width = width ?? -1,
      height = height ?? -1,
      srcLeft = srcLeft ?? -1,
      srcTop = srcTop ?? -1,
      srcRight = srcRight ?? -1,
      srcBottom = srcBottom ?? -1;