Announcing embedded-text 0.4.0
A new stable version of embedded-text
(which is now part of the embedded-graphics organization 🎉)
is available for download. embedded-text
extends the excellent embedded-graphics
library with
a TextBox
object that supports multiline text rendering with the common horizontal alignment options.
The new major features of this release are:
- In-line styling using ANSI escape sequences
Scrolling
vertical alignment- New text style options:
- Underlined (via
TextBoxStyleBuilder::underlined()
) - Strike-through (via
TextBoxStyleBuilder::strikethrough()
)
- Underlined (via
- Support for new special characters:
- tab (
\t
) with configurable tab size
- tab (
Partial ANSI escape sequence support
You can now use ANSI escape sequences to style your text. ANSI sequences provide a method to define
text style in line with the text itself. This is a more flexible, but perhaps a bit more involved
method to style your text compared to specifying a static style using TextBoxStyleBuilder
.
For the list of supported sequences, please see the documentation.
Check out the colored_text
example for a demo, which renders the following image:
Scrolling alignment
Scrolling alignment is a combination of the Top and Bottom vertical alignments. If the text does not
completely fill the bounding box, it behaves as Top aligned, otherwise as Bottom aligned. This is
especially suited for terminal-like, editor-like applications where the last line should always be
visible.
See the editor
example for a demo application.
New special characters
You can now use (horizontal) tab characters \t
to tabulate text. The default tab width is 4 spaces
and it is configurable through TextBoxStyleBuilder::tab_size()
. This function takes a TabSize
struct, which can represent either a number of pixels or a number of space characters.
See the tabs
example for how to configure tab size.
For a complete list of changes (excluding some under the hood changes), see the changelog
To install, add the following to your Cargo.toml
dependencies:
embedded-text = "0.4.0"
For documentation, see docs.rs.
I really hope you give embedded-text
a try! If you have any questions, suggestions, issues,
feature requests, or if you’d like to contribute, feel free to open an issue or a pull request on
the GitHub repository!