textbox
An elegant utility for constructing templates that can have text or images slotted into an existing layout.
Overview
By initializing a TextBox, you can define a template image and place named components on it:
- Text components (
TextArea) for rendering text - Image components (
ImageArea) for overlaying images
Once the template is defined, you can fill in content at runtime with a TextBoxRender, placing text and images in predictable slots.
Quickstart
let mut template: DynamicImage = /* ... */;
let text_box = new
.image_component
.text_component;
let flag: DynamicImage = /* ... */;
let render = new
.image
.text;
let img = text_box.render?;
--
Design
TextBox is dependent on the image, imageproc and ab_glyph crates. The goal is to make it easy to create reusable containers for slotting images and text into predictable slots.
Text fields allow for a subset of markdown styles if the provided font is a variable font, like Roboto Flex. Bold, italic, and colored styles are usable. Colored styles use Markdown link syntax, i.e. [Colored Text](#FF0000), since static images could never be clickable links anyway. If the font doesn't support those features, all styles will be ignored.