Documentation
¶
Overview ¶
Package runes contains commonly used runes and functions to obtain runes.
Index ¶
- Constants
- func ArcLineFromLineSegments(l LineSegments) rune
- func BraillePatternFromPatternDots(p PatternDots) (r rune)
- func CandlestickFromCandlestickSegments(c CandlestickSegments) rune
- func CombineBraillePatterns(r1 rune, r2 rune) rune
- func CombineCandlesticks(r1 rune, r2 rune) (r rune)
- func CombineLines(r1 rune, r2 rune, ls LineStyle) (r rune)
- func IsBraillePattern(r rune) bool
- func IsCandlestick(r rune) bool
- func IsLeftBlockElement(r rune) bool
- func IsLine(r rune) bool
- func IsLowerBlockElement(r rune) bool
- func LeftBlockElementFromFloat64(f float64) rune
- func LowerBlockElementFromFloat64(f float64) rune
- func SetCandlestickSegments(r rune, c *CandlestickSegments)
- func SetLineSegments(r rune, l *LineSegments)
- func SetPatternDots(r rune, p *PatternDots)
- func ThinLineFromLineSegments(l LineSegments) rune
- type CandlestickSegments
- type LineSegments
- type LineStyle
- type PatternDots
- type PatternDotsGrid
Constants ¶
const ( Null = '\u0000' LineHorizontal = '\u2500' // ─ LineVertical = '\u2502' // │ LineVerticalHeavy = '\u2503' // ┃ LineDownRight = '\u250C' // ┌ LineDownLeft = '\u2510' // ┐ LineUpRight = '\u2514' // └ LineUpLeft = '\u2518' // ┘ LineVerticalRight = '\u251C' // ├ LineVerticalLeft = '\u2524' // ┤ LineHorizontalUp = '\u2534' // ┴ LineHorizontalDown = '\u252C' // ┬ LineHorizontalVertical = '\u253C' // ┼ LineLeft = '\u2574' // ╴ LineUp = '\u2575' // ╵ LineRight = '\u2576' // ╶ LineDown = '\u2577' // ╷ LineUpHeavy = '\u2579' // ╹ LineDownHeavy = '\u257B' // ╻ LineUpDownHeavy = '\u257D' // ╽ LineUpHeavyDown = '\u257F' // ╿ ArcDownRight = '\u256D' // ╭ ArcDownLeft = '\u256E' // ╮ ArcUpLeft = '\u256F' // ╯ ArcUpRight = '\u2570' // ╰ LowerBlockOne = '\u2581' // ▁ LowerBlockTwo = '\u2582' // ▂ LowerBlockThree = '\u2583' // ▃ LowerBlockFour = '\u2584' // ▄ LowerBlockFive = '\u2585' // ▅ LowerBlockSix = '\u2586' // ▆ LowerBlockSeven = '\u2587' // ▇ FullBlock = '\u2588' // █ LeftBlockSeven = '\u2589' // ▉ LeftBlockSix = '\u258A' // ▊ LeftBlockFive = '\u258B' // ▋ LeftBlockFour = '\u258C' // ▌ LeftBlockThree = '\u258D' // ▍ LeftBlockTwo = '\u258E' // ▎ LeftBlockOne = '\u258F' // ▏ )
const BrailleBlockOffset = 0x2800 // beginning of Unicode Braille Patterns (empty Braille Pattern)
Variables ¶
This section is empty.
Functions ¶
func ArcLineFromLineSegments ¶
func ArcLineFromLineSegments(l LineSegments) rune
ArcLineFromLineSegments returns either an empty rune or a line rune using given LineSegments. LineSegments contain whether or not the returned rune should display arc lines going up, down, left or right.
func BraillePatternFromPatternDots ¶
func BraillePatternFromPatternDots(p PatternDots) (r rune)
BraillePatternFromPatternDots returns a Braille Pattern rune using given PatternDots. Each index in PatternDots corresponds to Braille dot number and whether the dot should be displayed.
func CandlestickFromCandlestickSegments ¶ added in v0.2.0
func CandlestickFromCandlestickSegments(c CandlestickSegments) rune
CandlestickFromCandlestickSegments returns either an empty rune or a candlestick rune using given CandlestickSegments. CandlestickSegments contain whether or not the returned rune should display thin or heavy lines going up or down.
func CombineBraillePatterns ¶
CombineBraillePatterns returns a rune that is a combination of two braille pattern runes. Any invalid braille pattern rune combinations will return r2.
func CombineCandlesticks ¶ added in v0.2.0
CombineCandlesticks returns a rune that is a combination of two candlestick runes. Invalid candlestick rune combinations will return r2.
func CombineLines ¶
CombineLines returns a rune that is a combination of two line runes. Invalid line rune combinations or invalid LineStyle will return r2. The Linestyle determines the output line rune, even if the two input line runes are not of that style.
func IsBraillePattern ¶
IsBraillePattern returns whether a given rune is considered a Braile Pattern rune.
func IsCandlestick ¶ added in v0.2.0
IsCandlestick returns whether a given rune is considered a candlestick rune used for drawing candlesticks.
func IsLeftBlockElement ¶
IsLeftBlockElement returns whether a given rune is considered a left block or full block element.
func IsLowerBlockElement ¶
IsLowerBlockElement returns whether a given rune is considered a lower block or full block element.
func LeftBlockElementFromFloat64 ¶
LeftBlockElementFromFloat64 returns either an empty rune or a left Block Element rune using given float64. A float64 < 1.0 will return the nearest one eights left block element corresponding to the float value. An empty rune will be returned if float64 does not round to lowest 1/8 left block.
func LowerBlockElementFromFloat64 ¶
LowerBlockElementFromFloat64 returns either an empty rune or a lower Block Element rune using given float64. A float64 < 1.0 will return the nearest one eights lower block element corresponding to the float value. An empty rune will be returned if float64 does not round to lowest 1/8 lower block.
func SetCandlestickSegments ¶ added in v0.2.0
func SetCandlestickSegments(r rune, c *CandlestickSegments)
SetCandlestickSegments sets given CandlestickSegments segments based on given rune.
func SetLineSegments ¶
func SetLineSegments(r rune, l *LineSegments)
SetLineSegments sets given LineSegments directions based on given rune.
func SetPatternDots ¶
func SetPatternDots(r rune, p *PatternDots)
SetPatternDots sets given PatternDots dots based on given rune.
func ThinLineFromLineSegments ¶
func ThinLineFromLineSegments(l LineSegments) rune
ThinLineFromLineSegments returns either an empty rune or a line rune using given LineSegments. LineSegments contain whether or not the returned rune should display thin lines going up, down, left or right.
Types ¶
type CandlestickSegments ¶ added in v0.2.0
CandlestickSegments indicates whether a candlestick segment going up and down with thin or heavy lines is displayed.
type LineSegments ¶
LineSegments indicates whether a line segment going up, down, left, or right is displayed.
type LineStyle ¶
type LineStyle int
LineStyle enumerates the different style of line runes to display.
type PatternDots ¶
type PatternDots [8]bool
PatternDots indicates whether a dot in a Braille Pattern is displayed.
type PatternDotsGrid ¶
type PatternDotsGrid struct {
// contains filtered or unexported fields
}
PatternDotsGrid is a 2D array where each row and column indicates whether a dot in a sequence of Braille Patterns runes should be displayed. Example:
width = 4, height = 4 will give 2 Braille Pattern runes [0][3][0][3] [1][4][1][4] [2][5][2][5] [6][7][6][7] setting (0,0) will set Dot 0 of first braille rune setting (0,3) will set Dot 6 of first braille rune setting (3,0) will set Dot 3 of second braille rune setting (3,3) will set Dot 7 of second braille rune
func NewPatternDotsGrid ¶
func NewPatternDotsGrid(w, h int) *PatternDotsGrid
NewPatternDotsGrid returns new initialized *PatternDotsGrid
func (*PatternDotsGrid) BraillePatterns ¶
func (g *PatternDotsGrid) BraillePatterns() (p [][]rune)
BraillePatterns returns a [][]rune containing Braille Pattern runes based on internal grid values.
func (*PatternDotsGrid) Reset ¶
func (g *PatternDotsGrid) Reset()
Reset will reset the internal grid
func (*PatternDotsGrid) Set ¶
func (g *PatternDotsGrid) Set(x int, y int)
Set will set value in grid at given column and row
func (*PatternDotsGrid) Unset ¶
func (g *PatternDotsGrid) Unset(x int, y int)
Unset will unset value in grid at given column and row