|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Text drawn as glyph quads into one FormaTarget. More...
#include <TextSlice.hpp>
Collaboration diagram for MayaFlux::Portal::Forma::internal::TextSlice:Public Member Functions | |
| void | assign (std::string_view text, Text::PressParams params) |
| Replace text and parameters together. | |
| Kinesis::AABB2D | bounds () const noexcept |
| Text::GlyphMap | map () const noexcept |
| Layout pixels to NDC for the current bounds. | |
| void | refresh () |
| Write the current state to the target. No-op once the target is gone. | |
| const Text::TextRun & | run () const noexcept |
| Text::TextRun & | run () noexcept |
| void | set (std::string_view text) |
| Replace the text. | |
| void | set_bounds (Kinesis::AABB2D bounds) |
| Move the text to a new region. | |
| void | set_tail (std::vector< Kakshya::MeshVertex > tail) |
| Replace the extra vertices drawn after the glyphs, such as a caret. | |
Static Public Member Functions | |
| static std::shared_ptr< TextSlice > | make (FormaTarget target, Kinesis::AABB2D bounds, Text::PressParams params, std::string_view text) |
Draw text in bounds on target. | |
Private Member Functions | |
| bool | alive () const |
| TextSlice (FormaTarget target, Kinesis::AABB2D bounds, Text::PressParams params) | |
Private Attributes | |
| std::shared_ptr< Core::VKImage > | m_bound_image |
| Kinesis::AABB2D | m_bounds |
| Text::TextRun | m_run |
| std::vector< Kakshya::MeshVertex > | m_tail |
| FormaTarget | m_target |
Text drawn as glyph quads into one FormaTarget.
Owns a Text::TextRun and writes its vertices, an optional tail of extra vertices after them, and the atlas image binding to the target. The target's buffer must be created with a texture slot at index 0 (the atlas is bound there). Layout pixels map onto the bounds with Text::GlyphMap::fit against the run's extent, so a caller that sets render_bounds to the pixel size of the bounds, at least one line high, gets one layout pixel per screen pixel; shorter bounds squeeze the text to fit.
Every change rewrites the target's whole geometry. When an atlas image is replaced, because the atlas grew or was swapped, every live slice drawing from that atlas is written again, so no text is left on stale UVs. A slice whose target has been removed is left alone.
Always held through shared_ptr, made with make().
Definition at line 27 of file TextSlice.hpp.