class

CArcTextLayoutCache

Module
Arc
Header
#include "Arc/Text/CArcTextLayout.h"
Namespace
Arcf

Constructors

SignatureNameDescription
CArcTextLayoutCache(const CArcTextLayoutCache&) = deleteCArcTextLayoutCache

Public functions

ReturnsNameDescription
CArcTextLayoutCache&Get
CArcTextLayoutCache&operator=
const CArcTextLayout&GetLayout
const CArcTextLayout&GetLayout
voidTouchReports a layout the caller is holding by pointer as still live.
uint64_tGetEvictionGenerationBumped whenever the sweep actually removed something.
floatMeasureWidth
floatMeasureWidth
floatLineHeight
voidLineMetricsThe one definition of a line: baseline offset from the line top and the distance between baselines, from the primary face's vertical metrics at the device pixel size (or the style's LineHeight, with the difference split above and below).
floatCentredLineTopWhere to draw one line of text so its capital height is centred in [top, top + height): the ink a reader sees, not the line box, whose descent sat every centred label a pixel or two low.
floatCentredLineTop
floatCentredLayoutTopThe same for a layout already in hand, centred on face's capital (its primary face): what a widget that shaped its text itself calls.
ArcVec2CentredGlyphOriginWhere to draw an icon glyph (first code point of glyph, in family) so its ink is centred in box, not its advance box: the em's top is not the line top and an outline does not fill the em evenly.
voidPaintIconPaints an icon glyph with its ink centred in box: the one call every hand-painted icon goes through.
voidPaintPaints a layout through the batched renderer (bitmap atlas).
voidPaintThe font-carrying form, kept for callers that already hold one.
voidPaintRotatedCWPaints a single-line layout rotated 90 degrees clockwise (reads top-to-bottom); origin is the vertical column's top-left, the column width is the layout's line height.
voidBeginFrameFrame bookkeeping: bump the age counter and periodically evict entries that have not been used recently.
voidClear
const FStats&GetStats
voidResetStats

Function details

CArcTextLayoutCache

C++
CArcTextLayoutCache(const CArcTextLayoutCache&) = delete

Get

C++
static CArcTextLayoutCache& Get()

operator=

C++
CArcTextLayoutCache& operator=(const CArcTextLayoutCache&) = delete

GetLayout

C++
const CArcTextLayout& GetLayout(const std::string& text, const CArcFontInfo& font, const CArcTextLayoutParams& params)

GetLayout

C++
const CArcTextLayout& GetLayout(const std::string& text, const CArcFontInfo& font)

Touch

C++
void Touch(const CArcTextLayout& layout)

Reports a layout the caller is holding by pointer as still live. A widget that memoizes its layout stops asking for it by key, and without this the age sweep would drop the entry under it — which would be a dangling pointer, and, once every entry aged out at once, a frame that re-shaped the whole shell.

GetEvictionGeneration

C++
uint64_t GetEvictionGeneration() const

Bumped whenever the sweep actually removed something. A memoized layout pointer is only valid while this still matches.

MeasureWidth

C++
static float MeasureWidth(const std::string& text, const CArcFontInfo& font)

MeasureWidth

C++
static float MeasureWidth(const std::string& text, float fontSize, const std::string& fontFamily = "Default", bool bold = false)

LineHeight

C++
static float LineHeight(const CArcFontInfo& font)

LineMetrics

C++
static void LineMetrics(const CArcFontInfo& font, float rasterScale, float& outBaseline, float& outLineAdvance)

The one definition of a line: baseline offset from the line top and the distance between baselines, from the primary face's vertical metrics at the device pixel size (or the style's LineHeight, with the difference split above and below). Logical units on the device grid.

CentredLineTop

C++
static float CentredLineTop(const std::string& text, const CArcFontInfo& font, float top, float height)

Where to draw one line of text so its capital height is centred in [top, top + height): the ink a reader sees, not the line box, whose descent sat every centred label a pixel or two low. The baseline, not the line top, lands on a whole pixel: a fractional baseline let a capital's top edge spill one row and read a pixel high.

CentredLineTop

C++
static float CentredLineTop(const std::string& text, float size, const std::string& family, bool bold, float top, float height)

CentredLayoutTop

C++
static float CentredLayoutTop(const CArcTextLayout& layout, CArcFont* face, float top, float height)

The same for a layout already in hand, centred on face's capital (its primary face): what a widget that shaped its text itself calls.

CentredGlyphOrigin

C++
static ArcVec2 CentredGlyphOrigin(const ArcRect& box, const char* glyph, float size, const std::string& family)

Where to draw an icon glyph (first code point of glyph, in family) so its ink is centred in box, not its advance box: the em's top is not the line top and an outline does not fill the em evenly.

PaintIcon

C++
static void PaintIcon(CArcUIRenderer& renderer, const ArcRect& box, const std::string& glyph, float size, const ArcColor& color, const std::string& family = "Icons")

Paints an icon glyph with its ink centred in box: the one call every hand-painted icon goes through. A DrawString at the box's centre less half the size centres the em, and a Lucide outline stands on the baseline at the em's left, so such an icon sat low and to the left.

Paint

C++
static void Paint(CArcUIRenderer& renderer, const ArcVec2& origin, const CArcTextLayout& layout, const ArcColor& color, int32_t justify = 0, float justifyWidth = 0.0f)

Paints a layout through the batched renderer (bitmap atlas). Tofu glyphs draw as an outlined box. justifyWidth applies per-line center/right alignment (0 = left).

Paint

C++
static void Paint(CArcUIRenderer& renderer, const ArcVec2& origin, const CArcTextLayout& layout, const CArcFontInfo& font, const ArcColor& color, int32_t justify = 0, float justifyWidth = 0.0f)

The font-carrying form, kept for callers that already hold one. The paint itself reads nothing from it — the layout carries the shaped result and the atlas is global — so building a CArcFontInfo just to call this cost a std::string copy per text run per frame. Prefer the overload above.

PaintRotatedCW

C++
static void PaintRotatedCW(CArcUIRenderer& renderer, const ArcVec2& origin, const CArcTextLayout& layout, const CArcFontInfo& font, const ArcColor& color)

Paints a single-line layout rotated 90 degrees clockwise (reads top-to-bottom); origin is the vertical column's top-left, the column width is the layout's line height. Vertical sidebar tabs.

BeginFrame

C++
void BeginFrame()

Frame bookkeeping: bump the age counter and periodically evict entries that have not been used recently. Called from the renderer's per-window Begin().

Clear

C++
void Clear()

GetStats

C++
const FStats& GetStats() const

ResetStats

C++
void ResetStats()
Generated from Arc/Text/CArcTextLayout.h via arc.json · Nov 5, 2026Version 1.0.0