1package ansi
2
3// SelectCharacterSet sets the G-set character designator to the specified
4// character set.
5//
6// ESC Ps Pd
7//
8// Where Ps is the G-set character designator, and Pd is the identifier.
9// For 94-character sets, the designator can be one of:
10// - ( G0
11// - ) G1
12// - * G2
13// - + G3
14//
15// For 96-character sets, the designator can be one of:
16// - - G1
17// - . G2
18// - / G3
19//
20// Some common 94-character sets are:
21// - 0 DEC Special Drawing Set
22// - A United Kingdom (UK)
23// - B United States (USASCII)
24//
25// Examples:
26//
27// ESC ( B Select character set G0 = United States (USASCII)
28// ESC ( 0 Select character set G0 = Special Character and Line Drawing Set
29// ESC ) 0 Select character set G1 = Special Character and Line Drawing Set
30// ESC * A Select character set G2 = United Kingdom (UK)
31//
32// See: https://vt100.net/docs/vt510-rm/SCS.html
33func SelectCharacterSet(gset byte, charset byte) string {
34 return "\x1b" + string(gset) + string(charset)
35}
36
37// SCS is an alias for SelectCharacterSet.
38func SCS(gset byte, charset byte) string {
39 return SelectCharacterSet(gset, charset)
40}
41
42// Locking Shift 1 Right (LS1R) shifts G1 into GR character set.
43const LS1R = "\x1b~"
44
45// Locking Shift 2 (LS2) shifts G2 into GL character set.
46const LS2 = "\x1bn"
47
48// Locking Shift 2 Right (LS2R) shifts G2 into GR character set.
49const LS2R = "\x1b}"
50
51// Locking Shift 3 (LS3) shifts G3 into GL character set.
52const LS3 = "\x1bo"
53
54// Locking Shift 3 Right (LS3R) shifts G3 into GR character set.
55const LS3R = "\x1b|"