get_fonts

The font families the host registered: [{ fontKey, faces: [{ weight (a variable face: its [min, max] wght range), italic, variable }], synthetic (styles drawn by shearing or emboldening), fallback, state: loading | ready | failed }].

Query

Usage

TypeScript
surface.query('get_fonts')

Returns

object[], in the ok: true envelope.

JSON
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "fontKey": {
        "type": "string"
      },
      "faces": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "weight": {
              "type": [
                "number",
                "array"
              ],
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            },
            "italic": {
              "type": "boolean"
            },
            "variable": {
              "type": "boolean"
            }
          },
          "required": [
            "weight",
            "italic",
            "variable"
          ]
        }
      },
      "synthetic": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "italic",
            "bold"
          ]
        }
      },
      "fallback": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "state": {
        "type": "string",
        "enum": [
          "loading",
          "ready",
          "failed"
        ]
      }
    },
    "required": [
      "fontKey",
      "faces",
      "synthetic",
      "fallback",
      "state"
    ]
  }
}

See also