| 1 | package 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 |
| 33 | func SelectCharacterSet(gset byte, charset byte) string { |
| 34 | return "\x1b" + string(gset) + string(charset) |
| 35 | } |
| 36 | |
| 37 | // SCS is an alias for SelectCharacterSet. |
| 38 | func SCS(gset byte, charset byte) string { |
| 39 | return SelectCharacterSet(gset, charset) |
| 40 | } |
| 41 | |
| 42 | // LS1R (Locking Shift 1 Right) shifts G1 into GR character set. |
| 43 | const LS1R = "\x1b~" |
| 44 | |
| 45 | // LS2 (Locking Shift 2) shifts G2 into GL character set. |
| 46 | const LS2 = "\x1bn" |
| 47 | |
| 48 | // LS2R (Locking Shift 2 Right) shifts G2 into GR character set. |
| 49 | const LS2R = "\x1b}" |
| 50 | |
| 51 | // LS3 (Locking Shift 3) shifts G3 into GL character set. |
| 52 | const LS3 = "\x1bo" |
| 53 | |
| 54 | // LS3R (Locking Shift 3 Right) shifts G3 into GR character set. |
| 55 | const LS3R = "\x1b|" |