import "golang.org/x/text/unicode/bidi"
Package bidi contains functionality for bidirectional text support.
See http://www.unicode.org/reports/tr9.
NOTE: UNDER CONSTRUCTION. This API may change in backwards incompatible ways and without notice.
bidi.go bracket.go core.go tables.go trieval.go
const UnicodeVersion = "8.0.0"
UnicodeVersion is the Unicode version from which the tables in this package are derived.
AppendReverse reverses the order of characters of in, appends them to out, and returns the result. Modifiers will still follow the runes they modify. Brackets are replaced with their counterparts.
ReverseString reverses the order of characters in s and returns a new string. Modifiers will still follow the runes they modify. Brackets are replaced with their counterparts.
A Direction indicates the overall flow of text.
const ( // LeftToRight indicates the text contains no right-to-left characters and // that either there are some left-to-right characters or the option // DefaultDirection(LeftToRight) was passed. LeftToRight Direction = iota // RightToLeft indicates the text contains no left-to-right characters and // that either there are some right-to-left characters or the option // DefaultDirection(RightToLeft) was passed. RightToLeft // Mixed indicates text contains both left-to-right and right-to-left // characters. Mixed // Neutral means that text contains no left-to-right and right-to-left // characters and that no default direction has been set. Neutral )
type Option func(*options)
An Option is an option for Bidi processing.
DefaultDirection sets the default direction for a Paragraph. The direction is overridden if the text contains directional characters.
type Ordering struct{}
An Ordering holds the computed visual order of runs of a Paragraph. Calling SetBytes or SetString on the originating Paragraph invalidates an Ordering. The methods of an Ordering should only be called by one goroutine at a time.
Direction reports the directionality of the runs.
The direction may be LeftToRight, RightToLeft, Mixed, or Neutral.
NumRuns returns the number of runs.
Run returns the ith run within the ordering.
type Paragraph struct { }
A Paragraph holds a single Paragraph for Bidi processing.
Direction returns the direction of the text of this paragraph.
The direction may be LeftToRight, RightToLeft, Mixed, or Neutral.
IsLeftToRight reports whether the principle direction of rendering for this paragraphs is left-to-right. If this returns false, the principle direction of rendering is right-to-left.
Line computes the visual ordering of runs for a single line starting and ending at the given positions in the original text.
Order computes the visual ordering of all the runs in a Paragraph.
RunAt reports the Run at the given position of the input text.
This method can be used for computing line breaks on paragraphs.
SetBytes configures p for the given paragraph text. It replaces text previously set by SetBytes or SetString. If b contains a paragraph separator it will only process the first paragraph and report the number of bytes consumed from b including this separator. Error may be non-nil if options are given.
SetString configures p for the given paragraph text. It replaces text previously set by SetBytes or SetString. If b contains a paragraph separator it will only process the first paragraph and report the number of bytes consumed from b including this separator. Error may be non-nil if options are given.
type Run struct { }
A Run is a continuous sequence of characters of a single direction.
Bytes returns the text of the run in its original order.
Direction reports the direction of the run.
Position of the Run within the text passed to SetBytes or SetString of the originating Paragraph value.
String returns the text of the run in its original order.
Package bidi imports 4 packages (graph). Updated 6 days ago. Refresh now. Tools for package owners.