golib/helper/text/direction.go
2023-08-20 13:50:39 +08:00

25 lines
489 B
Go

package text
// Direction defines the overall flow of text. Similar to bidi.Direction, but
// simplified and specific to this package.
type Direction int
// Available Directions.
const (
Default Direction = iota
LeftToRight
RightToLeft
)
// Modifier returns a character to force the given direction for the text that
// follows the modifier.
func (d Direction) Modifier() string {
switch d {
case LeftToRight:
return "\u202a"
case RightToLeft:
return "\u202b"
}
return ""
}