class EE::Graphics::TextLayout

Overview

#include <textlayout.hpp>

class TextLayout {
public:
    // typedefs

    typedef std::shared_ptr<const TextLayout> Cache;

    // fields

    std::vector<ShapedTextParagraph> paragraphs;
    Sizef size;
    TextDirection direction { TextDirection::Unspecified };
    bool hasMixedDirection: 1 { false };

    // methods

    bool isRTL() const;
    SmallVector<Float, 4> getLinesWidth() const;

    static Cache layout(
        const String& string,
        Font* font,
        const Uint32& fontSize,
        const Uint32& style,
        const Uint32& tabWidth = 4,
        const Float& outlineThickness = 0.f,
        std::optional<Float> tabOffset = {},
        Uint32 textDrawHints = 0,
        TextDirection baseDirection = TextDirection::LeftToRight,
        LineWrapMode lineWrapMode = LineWrapMode::NoWrap,
        Uint32 wrapWidth = 0,
        bool keepIndentation = false,
        Float initialXOffset = 0
    );

    static Cache layout(
        const String::View& string,
        Font* font,
        const Uint32& fontSize,
        const Uint32& style,
        const Uint32& tabWidth = 4,
        const Float& outlineThickness = 0.f,
        std::optional<Float> tabOffset = {},
        Uint32 textDrawHints = 0,
        TextDirection baseDirection = TextDirection::LeftToRight,
        LineWrapMode lineWrapMode = LineWrapMode::NoWrap,
        Uint32 wrapWidth = 0,
        bool keepIndentation = false,
        Float initialXOffset = 0
    );

    static void clearLayoutCache(Font* font = nullptr);
};

Detailed Documentation

Methods

static void clearLayoutCache(Font* font = nullptr)

Removes entries from the shared text-layout LRU cache.

Parameters:

font

Optional borrowed font identity. When provided, only layouts requested with this font or containing shaped glyphs produced by this font are evicted. Passing nullptr clears the entire cache. Font destruction uses selective eviction before its borrowed pointers become invalid.