get_text_layout

The layout of drawn text nodeId (a 2D text shape or a 3D label) in its own frame and units of its font size, x right and y down: { revision, width, height, firstBaseline, inkBounds, lines: [{ start, end, x, top, baseline, width, trailing, rtl }], missing, missingCount } (offsets in UTF-16 units; missing: the first 16 code points no registered font maps). not_ready while the text is not laid out (no font registered yet, text disabled); invalid_params when nodeId is no drawn text.

Query

Usage

TypeScript
surface.query('get_text_layout', { nodeId })

Parameters

  • nodeIdstring

    Required

Returns

object with revision, width, height, firstBaseline, inkBounds, lines, missing, missingCount, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "width": {
      "type": "number"
    },
    "height": {
      "type": "number"
    },
    "firstBaseline": {
      "type": "number"
    },
    "inkBounds": {
      "type": "object",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "width": {
          "type": "number"
        },
        "height": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "width",
        "height"
      ]
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "start": {
            "type": "integer",
            "minimum": 0
          },
          "end": {
            "type": "integer",
            "minimum": 0
          },
          "x": {
            "type": "number"
          },
          "top": {
            "type": "number"
          },
          "baseline": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "trailing": {
            "type": "number"
          },
          "rtl": {
            "type": "boolean"
          }
        },
        "required": [
          "start",
          "end",
          "x",
          "top",
          "baseline",
          "width",
          "trailing",
          "rtl"
        ]
      }
    },
    "missing": {
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 0
      },
      "maxItems": 16
    },
    "missingCount": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": [
    "revision",
    "width",
    "height",
    "firstBaseline",
    "inkBounds",
    "lines",
    "missing",
    "missingCount"
  ]
}

See also