Package 

Object FontAsset.Companion

    • Method Detail

      • create

         final FontAsset create(CommandQueue riveWorker, ByteArray bytes)

        Creates and decodes a font asset from the given byte array on the provided Rive worker.

        The font can only be used on the same RiveWorker it was created on.

        Must be registered with FontAsset.register to be used for referenced fonts. Remove every registration with FontAsset.unregister, preferably before closing the font.

        ⚠️ The lifetime of the returned font is managed by the caller. Make sure to call close when you are done with it to release its resources. The returned font holds a reference to riveWorker, so closing it is required before the worker can fully release memory associated with this font.

        This is the replacement for fromBytes. Its temporary name avoids a source-incompatible overload; it will be renamed to fromBytes in 12.0 when the result-returning API is removed.

        Parameters:
        riveWorker - The Rive worker that owns the font.
        bytes - The byte array containing the font data to decode.
      • fromBytes

        @Deprecated(message = Use create. This result-returning implementation will be removed in 12.0, when create will be renamed to fromBytes and return the font directly.) final Result<FontAsset> fromBytes(CommandQueue riveWorker, ByteArray bytes)

        Decodes a font asset from bytes.

        Parameters:
        riveWorker - The Rive worker that owns the font.
        bytes - The encoded font bytes.
      • getLabel

         String getLabel()

        A label for the asset type, used in logging.