Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
6.1 KiB

4 years ago
  1. /*
  2. * Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih
  3. * MIT/X Consortium License
  4. */
  5. /*
  6. * U+25XX codepoints data
  7. *
  8. * References:
  9. * http://www.unicode.org/charts/PDF/U2500.pdf
  10. * http://www.unicode.org/charts/PDF/U2580.pdf
  11. *
  12. * Test page:
  13. * https://github.com/GNOME/vte/blob/master/doc/boxes.txt
  14. */
  15. /* Each shape is encoded as 16-bits. Higher bits are category, lower are data */
  16. /* Categories (mutually exclusive except BDB): */
  17. /* For convenience, BDL/BDA/BBS/BDB are 1 bit each, the rest are enums */
  18. #define BDL (1<<8) /* Box Draw Lines (light/double/heavy) */
  19. #define BDA (1<<9) /* Box Draw Arc (light) */
  20. #define BBD (1<<10) /* Box Block Down (lower) X/8 */
  21. #define BBL (2<<10) /* Box Block Left X/8 */
  22. #define BBU (3<<10) /* Box Block Upper X/8 */
  23. #define BBR (4<<10) /* Box Block Right X/8 */
  24. #define BBQ (5<<10) /* Box Block Quadrants */
  25. #define BRL (6<<10) /* Box Braille (data is lower byte of U28XX) */
  26. #define BBS (1<<14) /* Box Block Shades */
  27. #define BDB (1<<15) /* Box Draw is Bold */
  28. /* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical */
  29. /* Heavy is light+double (literally drawing light+double align to form heavy) */
  30. #define LL (1<<0)
  31. #define LU (1<<1)
  32. #define LR (1<<2)
  33. #define LD (1<<3)
  34. #define LH (LL+LR)
  35. #define LV (LU+LD)
  36. #define DL (1<<4)
  37. #define DU (1<<5)
  38. #define DR (1<<6)
  39. #define DD (1<<7)
  40. #define DH (DL+DR)
  41. #define DV (DU+DD)
  42. #define HL (LL+DL)
  43. #define HU (LU+DU)
  44. #define HR (LR+DR)
  45. #define HD (LD+DD)
  46. #define HH (HL+HR)
  47. #define HV (HU+HD)
  48. /* (BBQ) Quadrants Top/Bottom x Left/Right */
  49. #define TL (1<<0)
  50. #define TR (1<<1)
  51. #define BL (1<<2)
  52. #define BR (1<<3)
  53. /* Data for U+2500 - U+259F except dashes/diagonals */
  54. static const unsigned short boxdata[256] = {
  55. /* light lines */
  56. [0x00] = BDL + LH, /* light horizontal */
  57. [0x02] = BDL + LV, /* light vertical */
  58. [0x0c] = BDL + LD + LR, /* light down and right */
  59. [0x10] = BDL + LD + LL, /* light down and left */
  60. [0x14] = BDL + LU + LR, /* light up and right */
  61. [0x18] = BDL + LU + LL, /* light up and left */
  62. [0x1c] = BDL + LV + LR, /* light vertical and right */
  63. [0x24] = BDL + LV + LL, /* light vertical and left */
  64. [0x2c] = BDL + LH + LD, /* light horizontal and down */
  65. [0x34] = BDL + LH + LU, /* light horizontal and up */
  66. [0x3c] = BDL + LV + LH, /* light vertical and horizontal */
  67. [0x74] = BDL + LL, /* light left */
  68. [0x75] = BDL + LU, /* light up */
  69. [0x76] = BDL + LR, /* light right */
  70. [0x77] = BDL + LD, /* light down */
  71. /* heavy [+light] lines */
  72. [0x01] = BDL + HH,
  73. [0x03] = BDL + HV,
  74. [0x0d] = BDL + HR + LD,
  75. [0x0e] = BDL + HD + LR,
  76. [0x0f] = BDL + HD + HR,
  77. [0x11] = BDL + HL + LD,
  78. [0x12] = BDL + HD + LL,
  79. [0x13] = BDL + HD + HL,
  80. [0x15] = BDL + HR + LU,
  81. [0x16] = BDL + HU + LR,
  82. [0x17] = BDL + HU + HR,
  83. [0x19] = BDL + HL + LU,
  84. [0x1a] = BDL + HU + LL,
  85. [0x1b] = BDL + HU + HL,
  86. [0x1d] = BDL + HR + LV,
  87. [0x1e] = BDL + HU + LD + LR,
  88. [0x1f] = BDL + HD + LR + LU,
  89. [0x20] = BDL + HV + LR,
  90. [0x21] = BDL + HU + HR + LD,
  91. [0x22] = BDL + HD + HR + LU,
  92. [0x23] = BDL + HV + HR,
  93. [0x25] = BDL + HL + LV,
  94. [0x26] = BDL + HU + LD + LL,
  95. [0x27] = BDL + HD + LU + LL,
  96. [0x28] = BDL + HV + LL,
  97. [0x29] = BDL + HU + HL + LD,
  98. [0x2a] = BDL + HD + HL + LU,
  99. [0x2b] = BDL + HV + HL,
  100. [0x2d] = BDL + HL + LD + LR,
  101. [0x2e] = BDL + HR + LL + LD,
  102. [0x2f] = BDL + HH + LD,
  103. [0x30] = BDL + HD + LH,
  104. [0x31] = BDL + HD + HL + LR,
  105. [0x32] = BDL + HR + HD + LL,
  106. [0x33] = BDL + HH + HD,
  107. [0x35] = BDL + HL + LU + LR,
  108. [0x36] = BDL + HR + LU + LL,
  109. [0x37] = BDL + HH + LU,
  110. [0x38] = BDL + HU + LH,
  111. [0x39] = BDL + HU + HL + LR,
  112. [0x3a] = BDL + HU + HR + LL,
  113. [0x3b] = BDL + HH + HU,
  114. [0x3d] = BDL + HL + LV + LR,
  115. [0x3e] = BDL + HR + LV + LL,
  116. [0x3f] = BDL + HH + LV,
  117. [0x40] = BDL + HU + LH + LD,
  118. [0x41] = BDL + HD + LH + LU,
  119. [0x42] = BDL + HV + LH,
  120. [0x43] = BDL + HU + HL + LD + LR,
  121. [0x44] = BDL + HU + HR + LD + LL,
  122. [0x45] = BDL + HD + HL + LU + LR,
  123. [0x46] = BDL + HD + HR + LU + LL,
  124. [0x47] = BDL + HH + HU + LD,
  125. [0x48] = BDL + HH + HD + LU,
  126. [0x49] = BDL + HV + HL + LR,
  127. [0x4a] = BDL + HV + HR + LL,
  128. [0x4b] = BDL + HV + HH,
  129. [0x78] = BDL + HL,
  130. [0x79] = BDL + HU,
  131. [0x7a] = BDL + HR,
  132. [0x7b] = BDL + HD,
  133. [0x7c] = BDL + HR + LL,
  134. [0x7d] = BDL + HD + LU,
  135. [0x7e] = BDL + HL + LR,
  136. [0x7f] = BDL + HU + LD,
  137. /* double [+light] lines */
  138. [0x50] = BDL + DH,
  139. [0x51] = BDL + DV,
  140. [0x52] = BDL + DR + LD,
  141. [0x53] = BDL + DD + LR,
  142. [0x54] = BDL + DR + DD,
  143. [0x55] = BDL + DL + LD,
  144. [0x56] = BDL + DD + LL,
  145. [0x57] = BDL + DL + DD,
  146. [0x58] = BDL + DR + LU,
  147. [0x59] = BDL + DU + LR,
  148. [0x5a] = BDL + DU + DR,
  149. [0x5b] = BDL + DL + LU,
  150. [0x5c] = BDL + DU + LL,
  151. [0x5d] = BDL + DL + DU,
  152. [0x5e] = BDL + DR + LV,
  153. [0x5f] = BDL + DV + LR,
  154. [0x60] = BDL + DV + DR,
  155. [0x61] = BDL + DL + LV,
  156. [0x62] = BDL + DV + LL,
  157. [0x63] = BDL + DV + DL,
  158. [0x64] = BDL + DH + LD,
  159. [0x65] = BDL + DD + LH,
  160. [0x66] = BDL + DD + DH,
  161. [0x67] = BDL + DH + LU,
  162. [0x68] = BDL + DU + LH,
  163. [0x69] = BDL + DH + DU,
  164. [0x6a] = BDL + DH + LV,
  165. [0x6b] = BDL + DV + LH,
  166. [0x6c] = BDL + DH + DV,
  167. /* (light) arcs */
  168. [0x6d] = BDA + LD + LR,
  169. [0x6e] = BDA + LD + LL,
  170. [0x6f] = BDA + LU + LL,
  171. [0x70] = BDA + LU + LR,
  172. /* Lower (Down) X/8 block (data is 8 - X) */
  173. [0x81] = BBD + 7, [0x82] = BBD + 6, [0x83] = BBD + 5, [0x84] = BBD + 4,
  174. [0x85] = BBD + 3, [0x86] = BBD + 2, [0x87] = BBD + 1, [0x88] = BBD + 0,
  175. /* Left X/8 block (data is X) */
  176. [0x89] = BBL + 7, [0x8a] = BBL + 6, [0x8b] = BBL + 5, [0x8c] = BBL + 4,
  177. [0x8d] = BBL + 3, [0x8e] = BBL + 2, [0x8f] = BBL + 1,
  178. /* upper 1/2 (4/8), 1/8 block (X), right 1/2, 1/8 block (8-X) */
  179. [0x80] = BBU + 4, [0x94] = BBU + 1,
  180. [0x90] = BBR + 4, [0x95] = BBR + 7,
  181. /* Quadrants */
  182. [0x96] = BBQ + BL,
  183. [0x97] = BBQ + BR,
  184. [0x98] = BBQ + TL,
  185. [0x99] = BBQ + TL + BL + BR,
  186. [0x9a] = BBQ + TL + BR,
  187. [0x9b] = BBQ + TL + TR + BL,
  188. [0x9c] = BBQ + TL + TR + BR,
  189. [0x9d] = BBQ + TR,
  190. [0x9e] = BBQ + BL + TR,
  191. [0x9f] = BBQ + BL + TR + BR,
  192. /* Shades, data is an alpha value in 25% units (1/4, 1/2, 3/4) */
  193. [0x91] = BBS + 1, [0x92] = BBS + 2, [0x93] = BBS + 3,
  194. /* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */
  195. /* U+2571 - U+2573: unsupported (diagonals) */
  196. };