RenderOptions.fromJson constructor

RenderOptions.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory RenderOptions.fromJson(Map<String, Object?> json) {
  return RenderOptions(
    text: _policy(json['text']) ?? TextPolicy.embedFont,
    textByFamily: {
      for (var entry
          in (json['textByFamily'] as Map<String, Object?>? ?? const {})
              .entries)
        entry.key: ?_policy(entry.value),
    },
    unsupported: switch (json['unsupported']) {
      String name => UnsupportedPolicy.values.byName(name),
      _ => UnsupportedPolicy.rasterize,
    },
    rasterScale: (json['rasterScale'] as num?)?.toDouble() ?? 3,
  );
}