runes.go 3.3 KB

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