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;

  TextGeometry _textBufferGeometry = TextGeometry.create(shapes, parameters);

  return _textBufferGeometry;
}