Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Is there a function for creating a font interface from a font string, similar to image[]?

(2 edits) (+1)

Not directly, no.

The Array, Image and Sound interfaces can be encoded as strings or reconstituted from strings via their "constructor" functions- array[], image[], sound[]. All of these are "free-floating" value-like objects that have no connection to or awareness of a deck.

Fonts are always part of a deck. The deck.add[] function can be used to create new fonts or make a copy of existing fonts, and deck.remove[] can likewise remove an existing font from a deck, which will as a side effect modify any widgets previously referencing said font. In Lilt, you can have access to multiple deck interfaces at the same time, so it's possible to copy fonts between decks.

It is technically possible to obtain encoded font strings- indirectly- via deck.copy[] and card.copy[], since those functions produce the same JSON-encoded string blobs you get when you copy cards or widgets manually, and correspondingly it is possible to use deck.paste[] and card.paste[] to indirectly add fonts or prototypes to a deck. In either case, manually parsing the copied representation of cards or widgets is a hack; the format used is subject to change in the future.

The ideal way to distribute Decker fonts, like modules, is to package them as decks. The other alternative is to copy a widget and share the "%%WGT0 " representation of that widget, along with any fonts and/or prototypes it may depend upon.