package bidi
Import Path
vendor/golang.org/x/text/unicode/bidi (on go.dev)
Dependency Relation
imports 6 packages, and imported by 2 packages
Involved Source Files
Package bidi contains functionality for bidirectional text support.
See https://www.unicode.org/reports/tr9.
NOTE: UNDER CONSTRUCTION. This API may change in backwards incompatible ways
and without notice.
bracket.go
core.go
prop.go
tables15.0.0.go
trieval.go
Package-Level Type Names (total 7)
Class is the Unicode BiDi class. Each rune has a single class.
func Properties.Class() Class
const AL
const AN
const B
const BN
const Control
const CS
const EN
const ES
const ET
const FSI
const L
const LRE
const LRI
const LRO
const NSM
const ON
const PDF
const PDI
const R
const RLE
const RLI
const RLO
const S
const WS
A Direction indicates the overall flow of text.
func (*Ordering).Direction() Direction
func (*Paragraph).Direction() Direction
func (*Run).Direction() Direction
func vendor/golang.org/x/text/secure/bidirule.Direction(b []byte) Direction
func vendor/golang.org/x/text/secure/bidirule.DirectionString(s string) Direction
func DefaultDirection(d Direction) Option
const LeftToRight
const Mixed
const Neutral
const RightToLeft
An Option is an option for Bidi processing.
func DefaultDirection(d Direction) Option
func (*Paragraph).SetBytes(b []byte, opts ...Option) (n int, err error)
func (*Paragraph).SetString(s string, opts ...Option) (n int, err error)
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.
func (*Paragraph).Line(start, end int) (Ordering, error)
func (*Paragraph).Order() (Ordering, error)
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 s for the given paragraph text. It replaces text
previously set by SetBytes or SetString. If s contains a paragraph separator
it will only process the first paragraph and report the number of bytes
consumed from s including this separator. Error may be non-nil if options are
given.
Properties provides access to BiDi properties of runes.
Class returns the Bidi class for p.
IsBracket reports whether the rune is a bracket.
IsOpeningBracket reports whether the rune is an opening bracket.
IsBracket must return true.
func Lookup(s []byte) (p Properties, sz int)
func LookupRune(r rune) (p Properties, size int)
func LookupString(s string) (p Properties, sz int)
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.
Pos returns the 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.
*Run : expvar.Var
*Run : fmt.Stringer
func (*Ordering).Run(i int) Run
func (*Paragraph).RunAt(pos int) Run
Package-Level Functions (total 6)
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.
DefaultDirection sets the default direction for a Paragraph. The direction is
overridden if the text contains directional characters.
Lookup returns properties for the first rune in s and the width in bytes of
its encoding. The size will be 0 if s does not hold enough bytes to complete
the encoding.
LookupRune returns properties for r.
LookupString returns properties for the first rune in s and the width in
bytes of its encoding. The size will be 0 if s does not hold enough bytes to
complete the encoding.
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.
Package-Level Constants (total 29)
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.
Mixed indicates text contains both left-to-right and right-to-left
characters.
Neutral means that text contains no left-to-right and right-to-left
characters and that no default direction has been set.
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.
UnicodeVersion is the Unicode version from which the tables in this package are derived.
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |