runes.go (3392B)
1 // Copyright 2015 The TCell Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use file except in compliance with the License. 5 // You may obtain a copy of the license at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package tcell 16 17 // The names of these constants are chosen to match Terminfo names, 18 // modulo case, and changing the prefix from ACS_ to Rune. These are 19 // the runes we provide extra special handling for, with ASCII fallbacks 20 // for terminals that lack them. 21 const ( 22 RuneSterling = '£' 23 RuneDArrow = '↓' 24 RuneLArrow = '←' 25 RuneRArrow = '→' 26 RuneUArrow = '↑' 27 RuneBullet = '·' 28 RuneBoard = '░' 29 RuneCkBoard = '▒' 30 RuneDegree = '°' 31 RuneDiamond = '◆' 32 RuneGEqual = '≥' 33 RunePi = 'π' 34 RuneHLine = '─' 35 RuneLantern = '§' 36 RunePlus = '┼' 37 RuneLEqual = '≤' 38 RuneLLCorner = '└' 39 RuneLRCorner = '┘' 40 RuneNEqual = '≠' 41 RunePlMinus = '±' 42 RuneS1 = '⎺' 43 RuneS3 = '⎻' 44 RuneS7 = '⎼' 45 RuneS9 = '⎽' 46 RuneBlock = '█' 47 RuneTTee = '┬' 48 RuneRTee = '┤' 49 RuneLTee = '├' 50 RuneBTee = '┴' 51 RuneULCorner = '┌' 52 RuneURCorner = '┐' 53 RuneVLine = '│' 54 ) 55 56 // RuneFallbacks is the default map of fallback strings that will be 57 // used to replace a rune when no other more appropriate transformation 58 // is available, and the rune cannot be displayed directly. 59 // 60 // New entries may be added to this map over time, as it becomes clear 61 // that such is desirable. Characters that represent either letters or 62 // numbers should not be added to this list unless it is certain that 63 // the meaning will still convey unambiguously. 64 // 65 // As an example, it would be appropriate to add an ASCII mapping for 66 // the full width form of the letter 'A', but it would not be appropriate 67 // to do so a glyph representing the country China. 68 // 69 // Programs that desire richer fallbacks may register additional ones, 70 // or change or even remove these mappings with Screen.RegisterRuneFallback 71 // Screen.UnregisterRuneFallback methods. 72 // 73 // Note that Unicode is presumed to be able to display all glyphs. 74 // This is a pretty poor assumption, but there is no easy way to 75 // figure out which glyphs are supported in a given font. Hence, 76 // some care in selecting the characters you support in your application 77 // is still appropriate. 78 var RuneFallbacks = map[rune]string{ 79 RuneSterling: "f", 80 RuneDArrow: "v", 81 RuneLArrow: "<", 82 RuneRArrow: ">", 83 RuneUArrow: "^", 84 RuneBullet: "o", 85 RuneBoard: "#", 86 RuneCkBoard: ":", 87 RuneDegree: "\\", 88 RuneDiamond: "+", 89 RuneGEqual: ">", 90 RunePi: "*", 91 RuneHLine: "-", 92 RuneLantern: "#", 93 RunePlus: "+", 94 RuneLEqual: "<", 95 RuneLLCorner: "+", 96 RuneLRCorner: "+", 97 RuneNEqual: "!", 98 RunePlMinus: "#", 99 RuneS1: "~", 100 RuneS3: "-", 101 RuneS7: "-", 102 RuneS9: "_", 103 RuneBlock: "#", 104 RuneTTee: "+", 105 RuneRTee: "+", 106 RuneLTee: "+", 107 RuneBTee: "+", 108 RuneULCorner: "+", 109 RuneURCorner: "+", 110 RuneVLine: "|", 111 }