gitea源码

badge_glyph_width.go 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. // Copyright 2025 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package badge
  4. // DejaVuGlyphWidthData is generated by `sfnt.Face.GlyphAdvance(nil, <rune>, 11, font.HintingNone)` with DejaVu Sans
  5. // v2.37 (https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-sans-ttf-2.37.zip).
  6. //
  7. // Fonts defined in "DefaultFontFamily" all have similar widths (including "DejaVu Sans"),
  8. // and these widths are fixed and don't seem to change.
  9. //
  10. // A devtest page "/devtest/badge-actions-svg" could be used to check the rendered images.
  11. func dejaVuGlyphWidthDataFunc() map[rune]uint8 {
  12. return map[rune]uint8{
  13. 32: 3,
  14. 33: 4,
  15. 34: 5,
  16. 35: 9,
  17. 36: 7,
  18. 37: 10,
  19. 38: 9,
  20. 39: 3,
  21. 40: 4,
  22. 41: 4,
  23. 42: 6,
  24. 43: 9,
  25. 44: 3,
  26. 45: 4,
  27. 46: 3,
  28. 47: 4,
  29. 48: 7,
  30. 49: 7,
  31. 50: 7,
  32. 51: 7,
  33. 52: 7,
  34. 53: 7,
  35. 54: 7,
  36. 55: 7,
  37. 56: 7,
  38. 57: 7,
  39. 58: 4,
  40. 59: 4,
  41. 60: 9,
  42. 61: 9,
  43. 62: 9,
  44. 63: 6,
  45. 64: 11,
  46. 65: 8,
  47. 66: 8,
  48. 67: 8,
  49. 68: 8,
  50. 69: 7,
  51. 70: 6,
  52. 71: 9,
  53. 72: 8,
  54. 73: 3,
  55. 74: 3,
  56. 75: 7,
  57. 76: 6,
  58. 77: 9,
  59. 78: 8,
  60. 79: 9,
  61. 80: 7,
  62. 81: 9,
  63. 82: 8,
  64. 83: 7,
  65. 84: 7,
  66. 85: 8,
  67. 86: 8,
  68. 87: 11,
  69. 88: 8,
  70. 89: 7,
  71. 90: 8,
  72. 91: 4,
  73. 92: 4,
  74. 93: 4,
  75. 94: 9,
  76. 95: 6,
  77. 96: 6,
  78. 97: 7,
  79. 98: 7,
  80. 99: 6,
  81. 100: 7,
  82. 101: 7,
  83. 102: 4,
  84. 103: 7,
  85. 104: 7,
  86. 105: 3,
  87. 106: 3,
  88. 107: 6,
  89. 108: 3,
  90. 109: 11,
  91. 110: 7,
  92. 111: 7,
  93. 112: 7,
  94. 113: 7,
  95. 114: 5,
  96. 115: 6,
  97. 116: 4,
  98. 117: 7,
  99. 118: 7,
  100. 119: 9,
  101. 120: 7,
  102. 121: 7,
  103. 122: 6,
  104. 123: 7,
  105. 124: 4,
  106. 125: 7,
  107. 126: 9,
  108. 161: 4,
  109. 162: 7,
  110. 163: 7,
  111. 164: 7,
  112. 165: 7,
  113. 166: 4,
  114. 167: 6,
  115. 168: 6,
  116. 169: 11,
  117. 170: 5,
  118. 171: 7,
  119. 172: 9,
  120. 174: 11,
  121. 175: 6,
  122. 176: 6,
  123. 177: 9,
  124. 178: 4,
  125. 179: 4,
  126. 180: 6,
  127. 181: 7,
  128. 182: 7,
  129. 183: 3,
  130. 184: 6,
  131. 185: 4,
  132. 186: 5,
  133. 187: 7,
  134. 188: 11,
  135. 189: 11,
  136. 190: 11,
  137. 191: 6,
  138. 192: 8,
  139. 193: 8,
  140. 194: 8,
  141. 195: 8,
  142. 196: 8,
  143. 197: 8,
  144. 198: 11,
  145. 199: 8,
  146. 200: 7,
  147. 201: 7,
  148. 202: 7,
  149. 203: 7,
  150. 204: 3,
  151. 205: 3,
  152. 206: 3,
  153. 207: 3,
  154. 208: 9,
  155. 209: 8,
  156. 210: 9,
  157. 211: 9,
  158. 212: 9,
  159. 213: 9,
  160. 214: 9,
  161. 215: 9,
  162. 216: 9,
  163. 217: 8,
  164. 218: 8,
  165. 219: 8,
  166. 220: 8,
  167. 221: 7,
  168. 222: 7,
  169. 223: 7,
  170. 224: 7,
  171. 225: 7,
  172. 226: 7,
  173. 227: 7,
  174. 228: 7,
  175. 229: 7,
  176. 230: 11,
  177. 231: 6,
  178. 232: 7,
  179. 233: 7,
  180. 234: 7,
  181. 235: 7,
  182. 236: 3,
  183. 237: 3,
  184. 238: 3,
  185. 239: 3,
  186. 240: 7,
  187. 241: 7,
  188. 242: 7,
  189. 243: 7,
  190. 244: 7,
  191. 245: 7,
  192. 246: 7,
  193. 247: 9,
  194. 248: 7,
  195. 249: 7,
  196. 250: 7,
  197. 251: 7,
  198. 252: 7,
  199. 253: 7,
  200. 254: 7,
  201. 255: 7,
  202. }
  203. }