Schemas / Geometry / paint

rig.geometry.path

v0.31.0 · draft 2 fields 1 required

Fields

FieldTypeMeaning
commands array<object> required Ordered path commands
fillRule enumnonzero · evenodd optional Optional. nonzero, evenodd; absent = nonzero

Freeform 2D path command stream. Format when present. Space curves use rig.geometry.path3d.

Not a parametric shape. A contour that stays editable as parameters belongs to one of the primitives - rectangle, ellipse, line, polygon, regular_polygon, star, arc, ring, spline. Use a path once it has been resolved to commands, and never both for the same contour. Circular and elliptical arcs stay on arc; do not invent path arc commands for them.

Command

Closed contours use a close command. Skip or reject unknown types. Extend only by appending enum values.

Holes are extra move-to ... close subpaths - no holes array. First subpath is the outer (clockwise in 2D page space). Later subpaths with opposite winding punch holes when fillRule is nonzero. Under evenodd, overlap toggles and winding sign does not matter. Fonts / UFO stay nonzero. Glyph contours are in font-unit y-up (rig.font.glyph); opposite-winding subpaths still punch holes. Do not put fillRule on paint. Appearance: rig.paint.fill_stroke.

JSON Schema

Resolves at https://rig.works/schemas/rig.geometry.path.schema.jsonraw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.geometry.path.schema.json",
  "title": "rig.geometry.path",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "commands": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "move-to",
              "line-to",
              "cubic-to",
              "quad-to",
              "close"
            ]
          },
          "point": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          },
          "control1": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          },
          "control2": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          }
        }
      }
    },
    "fillRule": {
      "type": "string",
      "enum": [
        "nonzero",
        "evenodd"
      ]
    }
  },
  "required": [
    "commands"
  ]
}

Seen in

font-ufo.json · font-var.json