Documentation
    Preparing search index...

    Function registerTextSerializers

    • The §79 node-type pair for §49/§56's Text (R-28, 2026-08-13).

      const io = registerSceneNodeTypes({
      atlas: buildGlyphAtlas(),
      materials: resourceCatalog([["material/ink", ink]]),
      });

      A material key, text, size, letterSpacing, align, renderLayer, renderOrder, and the four drawable boolean flags — and no geometry key, for Sprite's reason: a Text derives its glyph quads from the four fields above and owns them, so that payload rebuilds the geometry exactly.

      The font is not in the document, for the reason a Label's is not (module header): a GlyphAtlas is a loaded resource, and §79 references resources rather than inlining them. It arrives through SceneNodeTypeOptions.atlas — the option that already exists for labels, reused rather than duplicated, so an application that draws both passes one atlas and gets both back.

      A Label restored without an atlas measures 0 × 0, which is what a label with no atlas is. A Text has no such state: its constructor requires a font, because there is no layout without one and no honest empty face to substitute. So a document naming a text node loaded with no atlas option throws, in the same voice and with the same fix-naming shape resolveResource uses for an unresolvable material key. Inventing a built-in face here would be worse than either: it would reload someone's scene in a font they never chose and never asked about.

      A pair of its own for registerShapeSerializers's reason: registering it is what pulls Text — and with it @fourjs/text's layoutText — into a bundle, and an application whose scenes carry no text should not pay for the layout engine to save one. registerSceneNodeTypes calls it, so an application that wants everything still makes one call.

      Matched by exact class identity, like every other pair here.

      Parameters

      • options: SceneNodeTypeOptions = {}

        the glyph atlas restored text nodes are given, and the §79 material catalog they resolve through

      Returns SceneNodeTypeSupport

      the writer and reader halves; pass both or neither