Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::BidiParagraph Class Reference

Owns stable Unicode scalar storage and resolved paragraphs. No library handle escapes. More...

#include "donner/svg/text/BidiParagraph.h"

Classes

struct  Run
 One level run of a line, returned in left-to-right visual order. More...
struct  InjectedControl
 A control that an inline element's unicode-bidi places around its content. It takes part in analysis but occupies no scalar index, so levels and runs describe only the scalars. More...

Public Member Functions

 BidiParagraph (BidiParagraph &&) noexcept
BidiParagraph & operator= (BidiParagraph &&) noexcept
 BidiParagraph (const BidiParagraph &)=delete
BidiParagraph & operator= (const BidiParagraph &)=delete
std::optional< std::vector< Run > > visualRuns (uint32_t start, uint32_t end, BidiResourceBudget &budget) const
 Resolve L1/L2 for a logical line; source paragraphs never reorder across each other.
uint8_t levelAt (uint32_t index) const
 Resolved level before line-specific trailing-space resets.
uint8_t paragraphLevelAt (uint32_t index) const
 Resolved base level of the source paragraph containing the scalar.

Static Public Member Functions

static std::optional< BidiParagraph > Analyze (std::vector< char32_t > codepoints, BidiResourceBudget &budget, uint8_t base=0, bool forceAnalysis=false, bool override=false, std::span< const InjectedControl > controls={})
 Analyze Donner-decoded scalars. Base 0/1 is explicit; 2 requests first-strong detection.
static bool NeedsAnalysis (char32_t codepoint)
 Whether a scalar can require right-to-left analysis at explicit base zero.
static bool IsControl (char32_t codepoint)
 Whether a source character affects bidi but consumes no SVG or DOM character index.
static bool IsNonspacing (char32_t codepoint)
 Whether the scalar is a nonspacing mark that stays attached to its preceding base.
static char32_t Mirror (char32_t codepoint)
 Unicode L4 mirror; characters without a paired mirror remain unchanged.
static uint32_t StrongScript (char32_t codepoint)
 Four-letter ISO 15924 tag of a strong script, or zero for script-neutral scalars.

Detailed Description

Owns stable Unicode scalar storage and resolved paragraphs. No library handle escapes.


Class Documentation

◆ donner::svg::BidiParagraph::Run

struct donner::svg::BidiParagraph::Run

One level run of a line, returned in left-to-right visual order.

Class Members
uint32_t end = 0
uint8_t level = 0
uint32_t start = 0

◆ donner::svg::BidiParagraph::InjectedControl

struct donner::svg::BidiParagraph::InjectedControl

A control that an inline element's unicode-bidi places around its content. It takes part in analysis but occupies no scalar index, so levels and runs describe only the scalars.

Class Members
uint32_t before = 0 Scalar index the control precedes; the scalar count for the end.
char32_t codepoint = 0 An explicit embedding, override, isolate or pop control.

Member Function Documentation

◆ Analyze()

std::optional< BidiParagraph > donner::svg::BidiParagraph::Analyze ( std::vector< char32_t > codepoints,
BidiResourceBudget & budget,
uint8_t base = 0,
bool forceAnalysis = false,
bool override = false,
std::span< const InjectedControl > controls = {} )
static

Analyze Donner-decoded scalars. Base 0/1 is explicit; 2 requests first-strong detection.

Parameters
codepointsOwned scalars, which remain pinned throughout analysis and line queries.
budgetCumulative admission shared by the caller's layout.
baseParagraph base direction: 0 for direction: ltr, 1 for rtl.
forceAnalysisWhether to bypass the equivalent all-left-to-right fast path.
overrideWhether every scalar takes the explicit base level without reordering by bidi type, as unicode-bidi: bidi-override on the paragraph's block container. Requires base 0 or 1.
controlsInjected controls in nondecreasing InjectedControl::before order. Each counts against the scalar budget, as does the leading control that carries a paragraph override when anything is injected. Controls nested inside an override, injected or in the source, still open levels. With no scalars the controls enclose nothing and are dropped.

◆ visualRuns()

std::optional< std::vector< Run > > donner::svg::BidiParagraph::visualRuns ( uint32_t start,
uint32_t end,
BidiResourceBudget & budget ) const

Resolve L1/L2 for a logical line; source paragraphs never reorder across each other.

Parameters
startFirst scalar of the line.
endExclusive scalar end.
budgetShared visual-run admission.

The documentation for this class was generated from the following file: