Magnum::Text::AbstractLayouter class

Base for text layouters.

Returned by AbstractFont::layout().

Subclassing

The AbstractFont plugin creates a local AbstractLayouter subclass and implements doRenderGlyph(). You don't need to do most of the redundant sanity checks, these things are checked by the implementation:

Constructors, destructors, conversion operators

AbstractLayouter(const AbstractLayouter&) deleted
Copying is not allowed.
AbstractLayouter(AbstractLayouter&&) deleted
Moving is not allowed.
AbstractLayouter(UnsignedInt glyphCount) protected explicit
Constructor.

Public functions

auto operator=(const AbstractLayouter&) -> AbstractLayouter& deleted
Copying is not allowed.
auto operator=(const AbstractLayouter&&) -> AbstractLayouter& deleted
Moving is not allowed.
auto glyphCount() const -> UnsignedInt
Count of glyphs in the laid out text.
auto renderGlyph(UnsignedInt i, Vector2& cursorPosition, Range2D& rectangle) -> Containers::Pair<Range2D, Range2D>
Render a glyph.

Private functions

auto doRenderGlyph(UnsignedInt i) -> Containers::Triple<Range2D, Range2D, Vector2> pure virtual
Implementation for renderGlyph()

Function documentation

Magnum::Text::AbstractLayouter::AbstractLayouter(UnsignedInt glyphCount) explicit protected

Constructor.

Parameters
glyphCount Count of glyphs in laid out text

Containers::Pair<Range2D, Range2D> Magnum::Text::AbstractLayouter::renderGlyph(UnsignedInt i, Vector2& cursorPosition, Range2D& rectangle)

Render a glyph.

Parameters
in Glyph index
cursorPosition in/out Cursor position
rectangle in/out Bounding rectangle

The function returns a pair of quad position and texture coordinates, advances cursorPosition to next character and updates rectangle with extended bounds. Expects that i is less than glyphCount().

Containers::Triple<Range2D, Range2D, Vector2> Magnum::Text::AbstractLayouter::doRenderGlyph(UnsignedInt i) pure virtual private

Implementation for renderGlyph()

Parameters
i Glyph index

Returns quad position (relative to current cursor position), texture coordinates and advance to the next glyph.