diff --git a/doc/lua_api.md b/doc/lua_api.md index 622993b7a4986..ae918a318904c 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -851,6 +851,41 @@ embedding a whole image, this may vary by use case. *See notes: `TEXMOD_UPSCALE`* +#### `[text::x:,` + +* ``: width +* ``: height +* ``: x position +* ``: y position +* ``: a formatted text encoded with base64 + +Creates a texture containing rendered texture, optionally with an `,` +position and `x` size. + +To avoid potential conflict between text and grammar of texture modifiers, +text must be encoded with base64 encoding. Global properties of text +is detected from global styles of hypertext, such as alignment and background +color. Most of the tags in hypertext is supported, except for item image and +interaction feature ``. + +The optional `,` position is used if provided, no matter whether the +`[text` is being overlaid onto another texture with '^' or not. + +When `[text` is overlaid onto another texture, it will not upscale or change +the resolution of the texture, the base texture will determine the output +resolution. In such case, `x` could be optional, and size of base +texture is considered as the size of typesetted text. + +In contrast, if `[text` is not overlaid onto another texture, `x` size +must be provided, and size of output texture is determined from provided size. + +Examples: + + [text:SGVsbG8gd29ybGQ=:64x64 + texture.png^[text:SGVsbG8gd29ybGQ= + texture.png^[text:SGVsbG8gd29ybGQ=:50x50:4,4 + + Hardware coloring -----------------