TextGeometry constructor

TextGeometry(
  1. String text,
  2. Map<String, dynamic> parameters
)

Implementation

factory TextGeometry(String text, Map<String, dynamic> parameters) {
  Font? font = parameters["font"];

  if (!(font != null && font.isFont)) {
    throw ('three.TextGeometry: font parameter is not an instance of three.Font.');
  }

  var shapes = font.generateShapes(text, size: parameters["size"]);

  // translate parameters to ExtrudeGeometry API

  parameters["depth"] = parameters["height"] ?? 50;

  // defaults

  if (parameters["bevelThickness"] == null) parameters["bevelThickness"] = 10;
  if (parameters["bevelSize"] == null) parameters["bevelSize"] = 8;
  if (parameters["bevelEnabled"] == null) parameters["bevelEnabled"] = false;

  return TextGeometry.create(shapes, parameters);
}