bindConstructorValues method

dynamic bindConstructorValues(
  1. Map<String, dynamic> options
)

Implementation

bindConstructorValues(Map<String, dynamic> options) {

  // print("Glyph.dart bindConstructorValues options: ${options} ");

  this.index = options["index"] ?? 0;

  // These three values cannot be deferred for memory optimization:
  this.name = options["name"] ?? null;
  this.unicode = options["unicode"] ?? null;
  this.unicodes = options["unicodes"] ?? (options["unicode"] != null ? [options["unicode"]] : []);

  // But by binding these values only when necessary, we reduce can
  // the memory requirements by almost 3% for larger fonts.
  if ( options['xMin'] != null ) {
    this.xMin = options["xMin"];
  }

  if ( options["yMin"] != null ) {
    this.yMin = options["yMin"];
  }

  if ( options["xMax"] != null ) {
    this.xMax = options["xMax"];
  }

  if ( options["yMax"] != null ) {
    this.yMax = options["yMax"];
  }

  if ( options["advanceWidth"] != null ) {
    this.advanceWidth = options["advanceWidth"];
  }

  // The path for a glyph is the most memory intensive, and is bound as a value
  // with a getter/setter to ensure we actually do path parsing only once the
  // path is actually needed by anything.
  // Object.defineProperty(this, 'path', getPathDefinition(this, options.path));
  _path = options["path"];
}