Documentation ¶
Overview ¶
Package bidi implements the bidi algorithm for converting logical-order strings to visual-order strings, using the Unicode algorithm. This is a complementary package to golang.org/x/text/unicode, which does not yet contain this functionality.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Displayer ¶
type Displayer struct { // Treat uppercase characters as RTL UpperIsRTL bool // Base direction. Default is bidi.Neutral BaseDir bidi.Direction // If not nil, debug output will be written here Debug io.Writer }
Displayer provides a configurable object for running Display. For typical usage, use the ordinary Display function instead.
func (Displayer) Display ¶
Display returns the visual order for str, which should be in logical order, using the configuration in d.
Example ¶
d := Displayer{ UpperIsRTL: true, Debug: os.Stdout, } visual, _ := d.Display("hello, WORLD") fmt.Println(visual)
Output: in getEmbeddingLevels base level : 0 base dir : L Chars : hello, WORLD Res. levels : 000000000000 Res. types :[LLLLLCWRRRRR] [ SS ] in explicitEmbedAndOverrides runs : [{sor:0 eor:0 start:0 length:12 Type:1}] Chars : hello, WORLD Res. levels : 000000000000 Res. types :[LLLLLCWRRRRR] [ SS ] in resolveWeakTypes runs : [{sor:0 eor:0 start:0 length:12 Type:1}] Chars : hello, WORLD Res. levels : 000000000000 Res. types :[LLLLLOWRRRRR] [ NS ] in resolveNeutralTypes Chars : hello, WORLD Res. levels : 000000000000 Res. types :[LLLLLLLRRRRR] in resolveImplicitLevels runs : [{sor:0 eor:0 start:0 length:12 Type:1}] Chars : hello, WORLD Res. levels : 000000011111 Res. types :[LLLLLLLRRRRR] in reorderResolvedLevels Chars : hello, DLROW Res. levels : 000000011111 Res. types :[LLLLLLLRRRRR] in applyMirroring Chars : hello, DLROW Res. levels : 000000011111 Res. types :[LLLLLLLRRRRR] hello, DLROW
Click to show internal directories.
Click to hide internal directories.