package bidi

Import Path
	github.com/go-text/typesetting/bidi (on go.dev)

Dependency Relation
	imports 3 packages, and imported by one package

Involved Source Files bidi implements the Unicode Bidi algorithm. The implementation is inspired by x/text/unicode/bidi, providing a similar API. bracket.go core.go
Package-Level Type Names (total 5)
/* sort by: | */
A Direction indicates the overall flow of text. func (*Paragraph).Segment(text []rune, defaultDirection Direction) Runs func (*Paragraph).SegmentBytes(text []byte, defaultDirection Direction) Runs func (*Paragraph).SegmentString(text string, defaultDirection Direction) Runs const LeftToRight const Neutral const RightToLeft
Level is the embedding level of a character. Even embedding levels indicate left-to-right order and odd levels indicate right-to-left order.
Paragraph is the main entry point of the package. It stores internal data required to segment a string, and should be reused to reduce allocations. Segment applies the Bidi algorithm. The returned runs are only valid until the next call to [Segment], [SegmentString] or [SegmentBytes]. [defaultDirection] is the default direction for the input text. The direction is overridden if the text contains directional characters. SegmentBytes is the same as [Segment], but avoid allocations if [text] is a byte slice. SegmentString is the same as [Segment], but avoid allocations if [text] is a string
Run is a slice of text with a constant direction. Start and End indicate the subslice of the input text : text[Start:End] Level Level Start and End indicate the subslice of the input text : text[Start:End] IsLeftToRight returns `true` for a RTL run. func (*Runs).Run(i int) Run
Runs holds the output of the Bidi algorithm. NumRuns returns the number of runs. Run returns the ith run of segmented text. This method panics if [i] is not in the range [0,NumRuns()[ func (*Paragraph).Segment(text []rune, defaultDirection Direction) Runs func (*Paragraph).SegmentBytes(text []byte, defaultDirection Direction) Runs func (*Paragraph).SegmentString(text string, defaultDirection Direction) Runs
Package-Level Constants (total 3)
const Neutral Direction = 0