fontconv 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/esm/_dnt.shims.d.ts +5 -0
  4. package/esm/_dnt.shims.js +61 -0
  5. package/esm/deps/deno.land/std@0.221.0/assert/assert.d.ts +12 -0
  6. package/esm/deps/deno.land/std@0.221.0/assert/assert.js +18 -0
  7. package/esm/deps/deno.land/std@0.221.0/assert/assertion_error.d.ts +14 -0
  8. package/esm/deps/deno.land/std@0.221.0/assert/assertion_error.js +18 -0
  9. package/esm/deps/deno.land/std@0.221.0/path/_common/assert_path.d.ts +1 -0
  10. package/esm/deps/deno.land/std@0.221.0/path/_common/assert_path.js +7 -0
  11. package/esm/deps/deno.land/std@0.221.0/path/_common/basename.d.ts +3 -0
  12. package/esm/deps/deno.land/std@0.221.0/path/_common/basename.js +40 -0
  13. package/esm/deps/deno.land/std@0.221.0/path/_common/common.d.ts +1 -0
  14. package/esm/deps/deno.land/std@0.221.0/path/_common/common.js +23 -0
  15. package/esm/deps/deno.land/std@0.221.0/path/_common/constants.d.ts +39 -0
  16. package/esm/deps/deno.land/std@0.221.0/path/_common/constants.js +46 -0
  17. package/esm/deps/deno.land/std@0.221.0/path/_common/dirname.d.ts +1 -0
  18. package/esm/deps/deno.land/std@0.221.0/path/_common/dirname.js +8 -0
  19. package/esm/deps/deno.land/std@0.221.0/path/_common/format.d.ts +3 -0
  20. package/esm/deps/deno.land/std@0.221.0/path/_common/format.js +19 -0
  21. package/esm/deps/deno.land/std@0.221.0/path/_common/from_file_url.d.ts +2 -0
  22. package/esm/deps/deno.land/std@0.221.0/path/_common/from_file_url.js +9 -0
  23. package/esm/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.d.ts +28 -0
  24. package/esm/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.js +237 -0
  25. package/esm/deps/deno.land/std@0.221.0/path/_common/normalize.d.ts +1 -0
  26. package/esm/deps/deno.land/std@0.221.0/path/_common/normalize.js +8 -0
  27. package/esm/deps/deno.land/std@0.221.0/path/_common/normalize_string.d.ts +1 -0
  28. package/esm/deps/deno.land/std@0.221.0/path/_common/normalize_string.js +77 -0
  29. package/esm/deps/deno.land/std@0.221.0/path/_common/relative.d.ts +1 -0
  30. package/esm/deps/deno.land/std@0.221.0/path/_common/relative.js +9 -0
  31. package/esm/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.d.ts +1 -0
  32. package/esm/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.js +19 -0
  33. package/esm/deps/deno.land/std@0.221.0/path/_common/to_file_url.d.ts +1 -0
  34. package/esm/deps/deno.land/std@0.221.0/path/_common/to_file_url.js +15 -0
  35. package/esm/deps/deno.land/std@0.221.0/path/_interface.d.ts +38 -0
  36. package/esm/deps/deno.land/std@0.221.0/path/_interface.js +3 -0
  37. package/esm/deps/deno.land/std@0.221.0/path/_os.d.ts +3 -0
  38. package/esm/deps/deno.land/std@0.221.0/path/_os.js +18 -0
  39. package/esm/deps/deno.land/std@0.221.0/path/basename.d.ts +17 -0
  40. package/esm/deps/deno.land/std@0.221.0/path/basename.js +26 -0
  41. package/esm/deps/deno.land/std@0.221.0/path/common.d.ts +13 -0
  42. package/esm/deps/deno.land/std@0.221.0/path/common.js +19 -0
  43. package/esm/deps/deno.land/std@0.221.0/path/constants.d.ts +3 -0
  44. package/esm/deps/deno.land/std@0.221.0/path/constants.js +6 -0
  45. package/esm/deps/deno.land/std@0.221.0/path/dirname.d.ts +5 -0
  46. package/esm/deps/deno.land/std@0.221.0/path/dirname.js +12 -0
  47. package/esm/deps/deno.land/std@0.221.0/path/extname.d.ts +6 -0
  48. package/esm/deps/deno.land/std@0.221.0/path/extname.js +13 -0
  49. package/esm/deps/deno.land/std@0.221.0/path/format.d.ts +8 -0
  50. package/esm/deps/deno.land/std@0.221.0/path/format.js +14 -0
  51. package/esm/deps/deno.land/std@0.221.0/path/from_file_url.d.ts +18 -0
  52. package/esm/deps/deno.land/std@0.221.0/path/from_file_url.js +24 -0
  53. package/esm/deps/deno.land/std@0.221.0/path/glob_to_regexp.d.ts +62 -0
  54. package/esm/deps/deno.land/std@0.221.0/path/glob_to_regexp.js +65 -0
  55. package/esm/deps/deno.land/std@0.221.0/path/is_absolute.d.ts +5 -0
  56. package/esm/deps/deno.land/std@0.221.0/path/is_absolute.js +12 -0
  57. package/esm/deps/deno.land/std@0.221.0/path/is_glob.d.ts +2 -0
  58. package/esm/deps/deno.land/std@0.221.0/path/is_glob.js +28 -0
  59. package/esm/deps/deno.land/std@0.221.0/path/join.d.ts +5 -0
  60. package/esm/deps/deno.land/std@0.221.0/path/join.js +12 -0
  61. package/esm/deps/deno.land/std@0.221.0/path/join_globs.d.ts +4 -0
  62. package/esm/deps/deno.land/std@0.221.0/path/join_globs.js +11 -0
  63. package/esm/deps/deno.land/std@0.221.0/path/mod.d.ts +56 -0
  64. package/esm/deps/deno.land/std@0.221.0/path/mod.js +60 -0
  65. package/esm/deps/deno.land/std@0.221.0/path/normalize.d.ts +7 -0
  66. package/esm/deps/deno.land/std@0.221.0/path/normalize.js +14 -0
  67. package/esm/deps/deno.land/std@0.221.0/path/normalize_glob.d.ts +4 -0
  68. package/esm/deps/deno.land/std@0.221.0/path/normalize_glob.js +11 -0
  69. package/esm/deps/deno.land/std@0.221.0/path/parse.d.ts +18 -0
  70. package/esm/deps/deno.land/std@0.221.0/path/parse.js +24 -0
  71. package/esm/deps/deno.land/std@0.221.0/path/posix/_util.d.ts +1 -0
  72. package/esm/deps/deno.land/std@0.221.0/path/posix/_util.js +8 -0
  73. package/esm/deps/deno.land/std@0.221.0/path/posix/basename.d.ts +17 -0
  74. package/esm/deps/deno.land/std@0.221.0/path/posix/basename.js +27 -0
  75. package/esm/deps/deno.land/std@0.221.0/path/posix/common.d.ts +13 -0
  76. package/esm/deps/deno.land/std@0.221.0/path/posix/common.js +19 -0
  77. package/esm/deps/deno.land/std@0.221.0/path/posix/constants.d.ts +3 -0
  78. package/esm/deps/deno.land/std@0.221.0/path/posix/constants.js +5 -0
  79. package/esm/deps/deno.land/std@0.221.0/path/posix/dirname.d.ts +14 -0
  80. package/esm/deps/deno.land/std@0.221.0/path/posix/dirname.js +45 -0
  81. package/esm/deps/deno.land/std@0.221.0/path/posix/extname.d.ts +15 -0
  82. package/esm/deps/deno.land/std@0.221.0/path/posix/extname.js +68 -0
  83. package/esm/deps/deno.land/std@0.221.0/path/posix/format.d.ts +6 -0
  84. package/esm/deps/deno.land/std@0.221.0/path/posix/format.js +11 -0
  85. package/esm/deps/deno.land/std@0.221.0/path/posix/from_file_url.d.ts +12 -0
  86. package/esm/deps/deno.land/std@0.221.0/path/posix/from_file_url.js +17 -0
  87. package/esm/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.d.ts +57 -0
  88. package/esm/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.js +69 -0
  89. package/esm/deps/deno.land/std@0.221.0/path/posix/is_absolute.d.ts +5 -0
  90. package/esm/deps/deno.land/std@0.221.0/path/posix/is_absolute.js +12 -0
  91. package/esm/deps/deno.land/std@0.221.0/path/posix/is_glob.d.ts +1 -0
  92. package/esm/deps/deno.land/std@0.221.0/path/posix/is_glob.js +3 -0
  93. package/esm/deps/deno.land/std@0.221.0/path/posix/join.d.ts +5 -0
  94. package/esm/deps/deno.land/std@0.221.0/path/posix/join.js +26 -0
  95. package/esm/deps/deno.land/std@0.221.0/path/posix/join_globs.d.ts +4 -0
  96. package/esm/deps/deno.land/std@0.221.0/path/posix/join_globs.js +26 -0
  97. package/esm/deps/deno.land/std@0.221.0/path/posix/mod.d.ts +38 -0
  98. package/esm/deps/deno.land/std@0.221.0/path/posix/mod.js +42 -0
  99. package/esm/deps/deno.land/std@0.221.0/path/posix/normalize.d.ts +7 -0
  100. package/esm/deps/deno.land/std@0.221.0/path/posix/normalize.js +25 -0
  101. package/esm/deps/deno.land/std@0.221.0/path/posix/normalize_glob.d.ts +4 -0
  102. package/esm/deps/deno.land/std@0.221.0/path/posix/normalize_glob.js +16 -0
  103. package/esm/deps/deno.land/std@0.221.0/path/posix/parse.d.ts +6 -0
  104. package/esm/deps/deno.land/std@0.221.0/path/posix/parse.js +98 -0
  105. package/esm/deps/deno.land/std@0.221.0/path/posix/relative.d.ts +7 -0
  106. package/esm/deps/deno.land/std@0.221.0/path/posix/relative.js +94 -0
  107. package/esm/deps/deno.land/std@0.221.0/path/posix/resolve.d.ts +5 -0
  108. package/esm/deps/deno.land/std@0.221.0/path/posix/resolve.js +48 -0
  109. package/esm/deps/deno.land/std@0.221.0/path/posix/to_file_url.d.ts +12 -0
  110. package/esm/deps/deno.land/std@0.221.0/path/posix/to_file_url.js +22 -0
  111. package/esm/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.d.ts +5 -0
  112. package/esm/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.js +10 -0
  113. package/esm/deps/deno.land/std@0.221.0/path/relative.d.ts +12 -0
  114. package/esm/deps/deno.land/std@0.221.0/path/relative.js +19 -0
  115. package/esm/deps/deno.land/std@0.221.0/path/resolve.d.ts +5 -0
  116. package/esm/deps/deno.land/std@0.221.0/path/resolve.js +14 -0
  117. package/esm/deps/deno.land/std@0.221.0/path/to_file_url.d.ts +18 -0
  118. package/esm/deps/deno.land/std@0.221.0/path/to_file_url.js +24 -0
  119. package/esm/deps/deno.land/std@0.221.0/path/to_namespaced_path.d.ts +5 -0
  120. package/esm/deps/deno.land/std@0.221.0/path/to_namespaced_path.js +14 -0
  121. package/esm/deps/deno.land/std@0.221.0/path/windows/_util.d.ts +3 -0
  122. package/esm/deps/deno.land/std@0.221.0/path/windows/_util.js +15 -0
  123. package/esm/deps/deno.land/std@0.221.0/path/windows/basename.d.ts +17 -0
  124. package/esm/deps/deno.land/std@0.221.0/path/windows/basename.js +39 -0
  125. package/esm/deps/deno.land/std@0.221.0/path/windows/common.d.ts +13 -0
  126. package/esm/deps/deno.land/std@0.221.0/path/windows/common.js +19 -0
  127. package/esm/deps/deno.land/std@0.221.0/path/windows/constants.d.ts +3 -0
  128. package/esm/deps/deno.land/std@0.221.0/path/windows/constants.js +5 -0
  129. package/esm/deps/deno.land/std@0.221.0/path/windows/dirname.d.ts +5 -0
  130. package/esm/deps/deno.land/std@0.221.0/path/windows/dirname.js +98 -0
  131. package/esm/deps/deno.land/std@0.221.0/path/windows/extname.d.ts +6 -0
  132. package/esm/deps/deno.land/std@0.221.0/path/windows/extname.js +68 -0
  133. package/esm/deps/deno.land/std@0.221.0/path/windows/format.d.ts +6 -0
  134. package/esm/deps/deno.land/std@0.221.0/path/windows/format.js +11 -0
  135. package/esm/deps/deno.land/std@0.221.0/path/windows/from_file_url.d.ts +14 -0
  136. package/esm/deps/deno.land/std@0.221.0/path/windows/from_file_url.js +26 -0
  137. package/esm/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.d.ts +57 -0
  138. package/esm/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.js +69 -0
  139. package/esm/deps/deno.land/std@0.221.0/path/windows/is_absolute.d.ts +5 -0
  140. package/esm/deps/deno.land/std@0.221.0/path/windows/is_absolute.js +27 -0
  141. package/esm/deps/deno.land/std@0.221.0/path/windows/is_glob.d.ts +1 -0
  142. package/esm/deps/deno.land/std@0.221.0/path/windows/is_glob.js +3 -0
  143. package/esm/deps/deno.land/std@0.221.0/path/windows/join.d.ts +5 -0
  144. package/esm/deps/deno.land/std@0.221.0/path/windows/join.js +72 -0
  145. package/esm/deps/deno.land/std@0.221.0/path/windows/join_globs.d.ts +4 -0
  146. package/esm/deps/deno.land/std@0.221.0/path/windows/join_globs.js +26 -0
  147. package/esm/deps/deno.land/std@0.221.0/path/windows/mod.d.ts +38 -0
  148. package/esm/deps/deno.land/std@0.221.0/path/windows/mod.js +42 -0
  149. package/esm/deps/deno.land/std@0.221.0/path/windows/normalize.d.ts +7 -0
  150. package/esm/deps/deno.land/std@0.221.0/path/windows/normalize.js +130 -0
  151. package/esm/deps/deno.land/std@0.221.0/path/windows/normalize_glob.d.ts +4 -0
  152. package/esm/deps/deno.land/std@0.221.0/path/windows/normalize_glob.js +16 -0
  153. package/esm/deps/deno.land/std@0.221.0/path/windows/parse.d.ts +6 -0
  154. package/esm/deps/deno.land/std@0.221.0/path/windows/parse.js +159 -0
  155. package/esm/deps/deno.land/std@0.221.0/path/windows/relative.d.ts +12 -0
  156. package/esm/deps/deno.land/std@0.221.0/path/windows/relative.js +121 -0
  157. package/esm/deps/deno.land/std@0.221.0/path/windows/resolve.d.ts +5 -0
  158. package/esm/deps/deno.land/std@0.221.0/path/windows/resolve.js +143 -0
  159. package/esm/deps/deno.land/std@0.221.0/path/windows/to_file_url.d.ts +14 -0
  160. package/esm/deps/deno.land/std@0.221.0/path/windows/to_file_url.js +31 -0
  161. package/esm/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.d.ts +5 -0
  162. package/esm/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.js +38 -0
  163. package/esm/fontconv/cli.d.ts +2 -0
  164. package/esm/fontconv/cli.js +36 -0
  165. package/esm/fontconv/mod.d.ts +10 -0
  166. package/esm/fontconv/mod.js +147 -0
  167. package/esm/fontconv/test.d.ts +1 -0
  168. package/esm/package.json +3 -0
  169. package/esm/test/bootstrap-icons.woff2 +0 -0
  170. package/esm/test/format-check.eot +0 -0
  171. package/esm/test/format-check.otf +0 -0
  172. package/esm/test/format-check.svg +25 -0
  173. package/esm/test/format-check.ttf +0 -0
  174. package/esm/test/format-check.woff +0 -0
  175. package/esm/test/format-check.woff2 +0 -0
  176. package/esm/test/material-icons.woff2 +0 -0
  177. package/esm/ttf2svg/mod.d.ts +9 -0
  178. package/esm/ttf2svg/mod.js +167 -0
  179. package/package.json +42 -0
  180. package/script/_dnt.shims.d.ts +5 -0
  181. package/script/_dnt.shims.js +65 -0
  182. package/script/deps/deno.land/std@0.221.0/assert/assert.d.ts +12 -0
  183. package/script/deps/deno.land/std@0.221.0/assert/assert.js +22 -0
  184. package/script/deps/deno.land/std@0.221.0/assert/assertion_error.d.ts +14 -0
  185. package/script/deps/deno.land/std@0.221.0/assert/assertion_error.js +22 -0
  186. package/script/deps/deno.land/std@0.221.0/path/_common/assert_path.d.ts +1 -0
  187. package/script/deps/deno.land/std@0.221.0/path/_common/assert_path.js +11 -0
  188. package/script/deps/deno.land/std@0.221.0/path/_common/basename.d.ts +3 -0
  189. package/script/deps/deno.land/std@0.221.0/path/_common/basename.js +46 -0
  190. package/script/deps/deno.land/std@0.221.0/path/_common/common.d.ts +1 -0
  191. package/script/deps/deno.land/std@0.221.0/path/_common/common.js +27 -0
  192. package/script/deps/deno.land/std@0.221.0/path/_common/constants.d.ts +39 -0
  193. package/script/deps/deno.land/std@0.221.0/path/_common/constants.js +49 -0
  194. package/script/deps/deno.land/std@0.221.0/path/_common/dirname.d.ts +1 -0
  195. package/script/deps/deno.land/std@0.221.0/path/_common/dirname.js +12 -0
  196. package/script/deps/deno.land/std@0.221.0/path/_common/format.d.ts +3 -0
  197. package/script/deps/deno.land/std@0.221.0/path/_common/format.js +24 -0
  198. package/script/deps/deno.land/std@0.221.0/path/_common/from_file_url.d.ts +2 -0
  199. package/script/deps/deno.land/std@0.221.0/path/_common/from_file_url.js +13 -0
  200. package/script/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.d.ts +28 -0
  201. package/script/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.js +241 -0
  202. package/script/deps/deno.land/std@0.221.0/path/_common/normalize.d.ts +1 -0
  203. package/script/deps/deno.land/std@0.221.0/path/_common/normalize.js +12 -0
  204. package/script/deps/deno.land/std@0.221.0/path/_common/normalize_string.d.ts +1 -0
  205. package/script/deps/deno.land/std@0.221.0/path/_common/normalize_string.js +81 -0
  206. package/script/deps/deno.land/std@0.221.0/path/_common/relative.d.ts +1 -0
  207. package/script/deps/deno.land/std@0.221.0/path/_common/relative.js +13 -0
  208. package/script/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.d.ts +1 -0
  209. package/script/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.js +23 -0
  210. package/script/deps/deno.land/std@0.221.0/path/_common/to_file_url.d.ts +1 -0
  211. package/script/deps/deno.land/std@0.221.0/path/_common/to_file_url.js +19 -0
  212. package/script/deps/deno.land/std@0.221.0/path/_interface.d.ts +38 -0
  213. package/script/deps/deno.land/std@0.221.0/path/_interface.js +4 -0
  214. package/script/deps/deno.land/std@0.221.0/path/_os.d.ts +3 -0
  215. package/script/deps/deno.land/std@0.221.0/path/_os.js +44 -0
  216. package/script/deps/deno.land/std@0.221.0/path/basename.d.ts +17 -0
  217. package/script/deps/deno.land/std@0.221.0/path/basename.js +30 -0
  218. package/script/deps/deno.land/std@0.221.0/path/common.d.ts +13 -0
  219. package/script/deps/deno.land/std@0.221.0/path/common.js +23 -0
  220. package/script/deps/deno.land/std@0.221.0/path/constants.d.ts +3 -0
  221. package/script/deps/deno.land/std@0.221.0/path/constants.js +9 -0
  222. package/script/deps/deno.land/std@0.221.0/path/dirname.d.ts +5 -0
  223. package/script/deps/deno.land/std@0.221.0/path/dirname.js +16 -0
  224. package/script/deps/deno.land/std@0.221.0/path/extname.d.ts +6 -0
  225. package/script/deps/deno.land/std@0.221.0/path/extname.js +17 -0
  226. package/script/deps/deno.land/std@0.221.0/path/format.d.ts +8 -0
  227. package/script/deps/deno.land/std@0.221.0/path/format.js +18 -0
  228. package/script/deps/deno.land/std@0.221.0/path/from_file_url.d.ts +18 -0
  229. package/script/deps/deno.land/std@0.221.0/path/from_file_url.js +28 -0
  230. package/script/deps/deno.land/std@0.221.0/path/glob_to_regexp.d.ts +62 -0
  231. package/script/deps/deno.land/std@0.221.0/path/glob_to_regexp.js +69 -0
  232. package/script/deps/deno.land/std@0.221.0/path/is_absolute.d.ts +5 -0
  233. package/script/deps/deno.land/std@0.221.0/path/is_absolute.js +16 -0
  234. package/script/deps/deno.land/std@0.221.0/path/is_glob.d.ts +2 -0
  235. package/script/deps/deno.land/std@0.221.0/path/is_glob.js +32 -0
  236. package/script/deps/deno.land/std@0.221.0/path/join.d.ts +5 -0
  237. package/script/deps/deno.land/std@0.221.0/path/join.js +16 -0
  238. package/script/deps/deno.land/std@0.221.0/path/join_globs.d.ts +4 -0
  239. package/script/deps/deno.land/std@0.221.0/path/join_globs.js +15 -0
  240. package/script/deps/deno.land/std@0.221.0/path/mod.d.ts +56 -0
  241. package/script/deps/deno.land/std@0.221.0/path/mod.js +89 -0
  242. package/script/deps/deno.land/std@0.221.0/path/normalize.d.ts +7 -0
  243. package/script/deps/deno.land/std@0.221.0/path/normalize.js +18 -0
  244. package/script/deps/deno.land/std@0.221.0/path/normalize_glob.d.ts +4 -0
  245. package/script/deps/deno.land/std@0.221.0/path/normalize_glob.js +15 -0
  246. package/script/deps/deno.land/std@0.221.0/path/parse.d.ts +18 -0
  247. package/script/deps/deno.land/std@0.221.0/path/parse.js +28 -0
  248. package/script/deps/deno.land/std@0.221.0/path/posix/_util.d.ts +1 -0
  249. package/script/deps/deno.land/std@0.221.0/path/posix/_util.js +12 -0
  250. package/script/deps/deno.land/std@0.221.0/path/posix/basename.d.ts +17 -0
  251. package/script/deps/deno.land/std@0.221.0/path/posix/basename.js +31 -0
  252. package/script/deps/deno.land/std@0.221.0/path/posix/common.d.ts +13 -0
  253. package/script/deps/deno.land/std@0.221.0/path/posix/common.js +23 -0
  254. package/script/deps/deno.land/std@0.221.0/path/posix/constants.d.ts +3 -0
  255. package/script/deps/deno.land/std@0.221.0/path/posix/constants.js +8 -0
  256. package/script/deps/deno.land/std@0.221.0/path/posix/dirname.d.ts +14 -0
  257. package/script/deps/deno.land/std@0.221.0/path/posix/dirname.js +49 -0
  258. package/script/deps/deno.land/std@0.221.0/path/posix/extname.d.ts +15 -0
  259. package/script/deps/deno.land/std@0.221.0/path/posix/extname.js +72 -0
  260. package/script/deps/deno.land/std@0.221.0/path/posix/format.d.ts +6 -0
  261. package/script/deps/deno.land/std@0.221.0/path/posix/format.js +15 -0
  262. package/script/deps/deno.land/std@0.221.0/path/posix/from_file_url.d.ts +12 -0
  263. package/script/deps/deno.land/std@0.221.0/path/posix/from_file_url.js +21 -0
  264. package/script/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.d.ts +57 -0
  265. package/script/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.js +73 -0
  266. package/script/deps/deno.land/std@0.221.0/path/posix/is_absolute.d.ts +5 -0
  267. package/script/deps/deno.land/std@0.221.0/path/posix/is_absolute.js +16 -0
  268. package/script/deps/deno.land/std@0.221.0/path/posix/is_glob.d.ts +1 -0
  269. package/script/deps/deno.land/std@0.221.0/path/posix/is_glob.js +7 -0
  270. package/script/deps/deno.land/std@0.221.0/path/posix/join.d.ts +5 -0
  271. package/script/deps/deno.land/std@0.221.0/path/posix/join.js +30 -0
  272. package/script/deps/deno.land/std@0.221.0/path/posix/join_globs.d.ts +4 -0
  273. package/script/deps/deno.land/std@0.221.0/path/posix/join_globs.js +30 -0
  274. package/script/deps/deno.land/std@0.221.0/path/posix/mod.d.ts +38 -0
  275. package/script/deps/deno.land/std@0.221.0/path/posix/mod.js +58 -0
  276. package/script/deps/deno.land/std@0.221.0/path/posix/normalize.d.ts +7 -0
  277. package/script/deps/deno.land/std@0.221.0/path/posix/normalize.js +29 -0
  278. package/script/deps/deno.land/std@0.221.0/path/posix/normalize_glob.d.ts +4 -0
  279. package/script/deps/deno.land/std@0.221.0/path/posix/normalize_glob.js +20 -0
  280. package/script/deps/deno.land/std@0.221.0/path/posix/parse.d.ts +6 -0
  281. package/script/deps/deno.land/std@0.221.0/path/posix/parse.js +102 -0
  282. package/script/deps/deno.land/std@0.221.0/path/posix/relative.d.ts +7 -0
  283. package/script/deps/deno.land/std@0.221.0/path/posix/relative.js +98 -0
  284. package/script/deps/deno.land/std@0.221.0/path/posix/resolve.d.ts +5 -0
  285. package/script/deps/deno.land/std@0.221.0/path/posix/resolve.js +75 -0
  286. package/script/deps/deno.land/std@0.221.0/path/posix/to_file_url.d.ts +12 -0
  287. package/script/deps/deno.land/std@0.221.0/path/posix/to_file_url.js +26 -0
  288. package/script/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.d.ts +5 -0
  289. package/script/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.js +14 -0
  290. package/script/deps/deno.land/std@0.221.0/path/relative.d.ts +12 -0
  291. package/script/deps/deno.land/std@0.221.0/path/relative.js +23 -0
  292. package/script/deps/deno.land/std@0.221.0/path/resolve.d.ts +5 -0
  293. package/script/deps/deno.land/std@0.221.0/path/resolve.js +18 -0
  294. package/script/deps/deno.land/std@0.221.0/path/to_file_url.d.ts +18 -0
  295. package/script/deps/deno.land/std@0.221.0/path/to_file_url.js +28 -0
  296. package/script/deps/deno.land/std@0.221.0/path/to_namespaced_path.d.ts +5 -0
  297. package/script/deps/deno.land/std@0.221.0/path/to_namespaced_path.js +18 -0
  298. package/script/deps/deno.land/std@0.221.0/path/windows/_util.d.ts +3 -0
  299. package/script/deps/deno.land/std@0.221.0/path/windows/_util.js +21 -0
  300. package/script/deps/deno.land/std@0.221.0/path/windows/basename.d.ts +17 -0
  301. package/script/deps/deno.land/std@0.221.0/path/windows/basename.js +43 -0
  302. package/script/deps/deno.land/std@0.221.0/path/windows/common.d.ts +13 -0
  303. package/script/deps/deno.land/std@0.221.0/path/windows/common.js +23 -0
  304. package/script/deps/deno.land/std@0.221.0/path/windows/constants.d.ts +3 -0
  305. package/script/deps/deno.land/std@0.221.0/path/windows/constants.js +8 -0
  306. package/script/deps/deno.land/std@0.221.0/path/windows/dirname.d.ts +5 -0
  307. package/script/deps/deno.land/std@0.221.0/path/windows/dirname.js +102 -0
  308. package/script/deps/deno.land/std@0.221.0/path/windows/extname.d.ts +6 -0
  309. package/script/deps/deno.land/std@0.221.0/path/windows/extname.js +72 -0
  310. package/script/deps/deno.land/std@0.221.0/path/windows/format.d.ts +6 -0
  311. package/script/deps/deno.land/std@0.221.0/path/windows/format.js +15 -0
  312. package/script/deps/deno.land/std@0.221.0/path/windows/from_file_url.d.ts +14 -0
  313. package/script/deps/deno.land/std@0.221.0/path/windows/from_file_url.js +30 -0
  314. package/script/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.d.ts +57 -0
  315. package/script/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.js +73 -0
  316. package/script/deps/deno.land/std@0.221.0/path/windows/is_absolute.d.ts +5 -0
  317. package/script/deps/deno.land/std@0.221.0/path/windows/is_absolute.js +31 -0
  318. package/script/deps/deno.land/std@0.221.0/path/windows/is_glob.d.ts +1 -0
  319. package/script/deps/deno.land/std@0.221.0/path/windows/is_glob.js +7 -0
  320. package/script/deps/deno.land/std@0.221.0/path/windows/join.d.ts +5 -0
  321. package/script/deps/deno.land/std@0.221.0/path/windows/join.js +76 -0
  322. package/script/deps/deno.land/std@0.221.0/path/windows/join_globs.d.ts +4 -0
  323. package/script/deps/deno.land/std@0.221.0/path/windows/join_globs.js +30 -0
  324. package/script/deps/deno.land/std@0.221.0/path/windows/mod.d.ts +38 -0
  325. package/script/deps/deno.land/std@0.221.0/path/windows/mod.js +58 -0
  326. package/script/deps/deno.land/std@0.221.0/path/windows/normalize.d.ts +7 -0
  327. package/script/deps/deno.land/std@0.221.0/path/windows/normalize.js +134 -0
  328. package/script/deps/deno.land/std@0.221.0/path/windows/normalize_glob.d.ts +4 -0
  329. package/script/deps/deno.land/std@0.221.0/path/windows/normalize_glob.js +20 -0
  330. package/script/deps/deno.land/std@0.221.0/path/windows/parse.d.ts +6 -0
  331. package/script/deps/deno.land/std@0.221.0/path/windows/parse.js +163 -0
  332. package/script/deps/deno.land/std@0.221.0/path/windows/relative.d.ts +12 -0
  333. package/script/deps/deno.land/std@0.221.0/path/windows/relative.js +125 -0
  334. package/script/deps/deno.land/std@0.221.0/path/windows/resolve.d.ts +5 -0
  335. package/script/deps/deno.land/std@0.221.0/path/windows/resolve.js +170 -0
  336. package/script/deps/deno.land/std@0.221.0/path/windows/to_file_url.d.ts +14 -0
  337. package/script/deps/deno.land/std@0.221.0/path/windows/to_file_url.js +35 -0
  338. package/script/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.d.ts +5 -0
  339. package/script/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.js +42 -0
  340. package/script/fontconv/cli.d.ts +2 -0
  341. package/script/fontconv/cli.js +61 -0
  342. package/script/fontconv/mod.d.ts +10 -0
  343. package/script/fontconv/mod.js +186 -0
  344. package/script/fontconv/test.d.ts +1 -0
  345. package/script/package.json +3 -0
  346. package/script/test/bootstrap-icons.woff2 +0 -0
  347. package/script/test/format-check.eot +0 -0
  348. package/script/test/format-check.otf +0 -0
  349. package/script/test/format-check.svg +25 -0
  350. package/script/test/format-check.ttf +0 -0
  351. package/script/test/format-check.woff +0 -0
  352. package/script/test/format-check.woff2 +0 -0
  353. package/script/test/material-icons.woff2 +0 -0
  354. package/script/ttf2svg/mod.d.ts +9 -0
  355. package/script/ttf2svg/mod.js +204 -0
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.convert = exports.filterGlyphs = exports.getFont = exports.otf2ttf = exports.isWOFF2 = exports.isWOFF = exports.isSVG = exports.isEOT = exports.isTTF = exports.isOTF = void 0;
30
+ const dntShim = __importStar(require("../_dnt.shims.js"));
31
+ const wawoff2_1 = require("wawoff2");
32
+ const opentype_js_1 = require("opentype.js");
33
+ const mod_js_1 = require("../ttf2svg/mod.js");
34
+ const svg2ttf_1 = __importDefault(require("svg2ttf"));
35
+ const ttf2eot_1 = __importDefault(require("ttf2eot"));
36
+ const ttf2woff_1 = __importDefault(require("ttf2woff"));
37
+ // import ttf2woff2 from "npm:ttf2woff2@5.0.0";
38
+ // import * as fonteditor from "npm:fonteditor-core@2.3.3"; // glyph names are lost
39
+ function isOTF(uint8Array) {
40
+ return uint8Array[0] === 0x4F &&
41
+ uint8Array[1] === 0x54 &&
42
+ uint8Array[2] === 0x54 &&
43
+ uint8Array[3] === 0x4F;
44
+ }
45
+ exports.isOTF = isOTF;
46
+ function isTTF(uint8Array) {
47
+ return uint8Array[0] === 0x00 &&
48
+ uint8Array[1] === 0x01 &&
49
+ uint8Array[2] === 0x00 &&
50
+ uint8Array[3] === 0x00;
51
+ }
52
+ exports.isTTF = isTTF;
53
+ function isEOT(uint8Array) {
54
+ return uint8Array[34] === 0x4C && uint8Array[35] === 0x50;
55
+ }
56
+ exports.isEOT = isEOT;
57
+ function isSVG(object) {
58
+ return typeof object === "string";
59
+ }
60
+ exports.isSVG = isSVG;
61
+ function isWOFF(uint8Array) {
62
+ return uint8Array[0] === 0x77 &&
63
+ uint8Array[1] === 0x4F &&
64
+ uint8Array[2] === 0x46 &&
65
+ uint8Array[3] === 0x46;
66
+ }
67
+ exports.isWOFF = isWOFF;
68
+ function isWOFF2(uint8Array) {
69
+ return uint8Array[0] === 0x77 &&
70
+ uint8Array[1] === 0x4F &&
71
+ uint8Array[2] === 0x46 &&
72
+ uint8Array[3] === 0x32;
73
+ }
74
+ exports.isWOFF2 = isWOFF2;
75
+ // glyph names are lost
76
+ // difficult: OTF --> TTF
77
+ // easy: OTF --> SVG --> TTF
78
+ // export function otf2ttf(otf) {
79
+ // const ttfObj = fonteditor.default.otf2ttfobject(otf);
80
+ // const ttfBuffer = new fonteditor.default.TTFWriter().write(ttfObj);
81
+ // return new Uint8Array(ttfBuffer);
82
+ // }
83
+ function otf2ttf(otf) {
84
+ const svg = (0, mod_js_1.ttf2svgFont)(new Uint8Array(otf));
85
+ return (0, svg2ttf_1.default)(svg).buffer;
86
+ }
87
+ exports.otf2ttf = otf2ttf;
88
+ // // TODO: not work
89
+ // export function eot2ttf(eot) {
90
+ // const ttfObj = fonteditor.default.eot2ttf(eot.buffer);
91
+ // const ttfBuffer = new fonteditor.default.TTFWriter().write(ttfObj);
92
+ // return new Uint8Array(ttfBuffer);
93
+ // }
94
+ function getGlyphString(options) {
95
+ if (options.textFile) {
96
+ const text = dntShim.Deno.readTextFileSync(options.textFile);
97
+ return text.trimEnd().replace(/\n/g, "");
98
+ }
99
+ else if (options.codeFile) {
100
+ const text = dntShim.Deno.readTextFileSync(options.codeFile);
101
+ return text.trimEnd().split("\n")
102
+ .map((line) => String.fromCodePoint(Number(line))).join("");
103
+ }
104
+ else if (options.text) {
105
+ return options.text;
106
+ }
107
+ else if (options.code) {
108
+ return options.code.split(",")
109
+ .map((code) => String.fromCodePoint(Number(code))).join("");
110
+ }
111
+ else {
112
+ return undefined;
113
+ }
114
+ }
115
+ async function getFont(fontContent) {
116
+ if (isSVG(fontContent)) {
117
+ const ttf = (0, svg2ttf_1.default)(fontContent);
118
+ return (0, opentype_js_1.parse)(ttf.buffer.buffer);
119
+ }
120
+ else if (isWOFF2(fontContent)) {
121
+ const data = await (0, wawoff2_1.decompress)(fontContent);
122
+ return (0, opentype_js_1.parse)(Uint8Array.from(data).buffer);
123
+ }
124
+ else if (isEOT(fontContent)) {
125
+ // const ttf = eot2ttf(fontContent);
126
+ // return parse(ttf.buffer);
127
+ throw new Error(".eot format input is no supported.");
128
+ }
129
+ else {
130
+ return (0, opentype_js_1.parse)(fontContent.buffer);
131
+ }
132
+ }
133
+ exports.getFont = getFont;
134
+ async function convertFormat(font, format) {
135
+ const svg = (0, mod_js_1.font2svgFont)(font);
136
+ if (format === ".svg")
137
+ return svg;
138
+ const ttf = (0, svg2ttf_1.default)(svg).buffer;
139
+ switch (format) {
140
+ case ".otf": {
141
+ const tempFont = (0, opentype_js_1.parse)(ttf.buffer);
142
+ return new Uint8Array(tempFont.toArrayBuffer());
143
+ }
144
+ case ".ttf":
145
+ return ttf;
146
+ case ".eot":
147
+ return (0, ttf2eot_1.default)(ttf);
148
+ case ".woff":
149
+ return (0, ttf2woff_1.default)(ttf);
150
+ case ".woff2":
151
+ // return ttf2woff2(ttf);
152
+ return await (0, wawoff2_1.compress)(ttf);
153
+ default:
154
+ throw new Error(`${format} is not a supported format.`);
155
+ }
156
+ }
157
+ function filterGlyphs(font, options) {
158
+ const glyphString = getGlyphString(options);
159
+ if (glyphString) {
160
+ return font.stringToGlyphs(glyphString);
161
+ }
162
+ else {
163
+ return Object.values(font.glyphs.glyphs);
164
+ }
165
+ }
166
+ exports.filterGlyphs = filterGlyphs;
167
+ function createTemporaryFont(font, glyphs) {
168
+ const notdefGlyph = font.glyphs.get(0);
169
+ const tempFont = new opentype_js_1.Font({
170
+ familyName: font.names.fontFamily.en,
171
+ styleName: font.names.fontSubfamily.en,
172
+ unitsPerEm: font.unitsPerEm,
173
+ ascender: font.ascender,
174
+ descender: font.descender,
175
+ glyphs: [notdefGlyph, ...glyphs],
176
+ });
177
+ tempFont.names = font.names;
178
+ return tempFont;
179
+ }
180
+ async function convert(fontContent, format, options) {
181
+ const font = await getFont(fontContent);
182
+ const glyphs = filterGlyphs(font, options);
183
+ const tempFont = createTemporaryFont(font, glyphs);
184
+ return await convertFormat(tempFont, format);
185
+ }
186
+ exports.convert = convert;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <!--
3
+
4
+
5
+
6
+
7
+ -->
8
+
9
+ <defs>
10
+ <font name="Material Icons Regular"
11
+ horiz-adv-x="512" vert-adv-y="512" >
12
+ <font-face font-family="Material Icons" font-weight="400"
13
+ font-stretch="normal"
14
+ units-per-em="512"
15
+ ascent="512"
16
+ descent="0"/>
17
+ <glyph glyph-name=".notdef" unicode="&#59530;"
18
+ horiz-adv-x="512" vert-adv-y="512"
19
+ d="M213 213L213 85L107 85L107 256L43 256L256 448L469 256L405 256L405 85L299 85L299 213L213 213Z"/>
20
+ <missing-glyph glyph-name=".notdef"
21
+ horiz-adv-x="512" vert-adv-y="512"
22
+ d="M213 213L213 85L107 85L107 256L43 256L256 448L469 256L405 256L405 85L299 85L299 213L213 213Z"/>
23
+ </font>
24
+ </defs>
25
+ </svg>
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,9 @@
1
+ export function toSVG(font: any, glyph: any, options?: {}): string | undefined;
2
+ export function toSVGFont(font: any, glyphs: any, options: any): string;
3
+ export function toGlyphTag(font: any, glyphs: any, options: any): any;
4
+ export function filterGlyphs(font: any, options?: {}): any;
5
+ export function font2svg(font: any, options: any): any;
6
+ export function ttf2svg(uint8array: any, options?: {}): any;
7
+ export function ttf2svgFont(uint8array: any, options?: {}): string;
8
+ export function font2svgFont(font: any, options?: {}): string;
9
+ export { parse };
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.font2svgFont = exports.ttf2svgFont = exports.ttf2svg = exports.font2svg = exports.filterGlyphs = exports.toGlyphTag = exports.toSVGFont = exports.toSVG = exports.parse = void 0;
30
+ const dntShim = __importStar(require("../_dnt.shims.js"));
31
+ const opentype_js_1 = require("opentype.js");
32
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return opentype_js_1.parse; } });
33
+ const svgpath_1 = __importDefault(require("svgpath"));
34
+ function calcLineSpace(font) {
35
+ const lineGap = font.tables.hhea?.lineGap ?? 0;
36
+ return font.ascender - font.descender + lineGap;
37
+ }
38
+ function svgHeader(font, glyph, options = {}) {
39
+ const widthAttribute = (options.width) ? `width="${options.width}"` : "";
40
+ const heightAttribute = (options.height) ? `height="${options.height}"` : "";
41
+ const glyphWidth = glyph.advanceWidth;
42
+ const glyphHeight = options.glyphHeight ?? calcLineSpace(font);
43
+ const copyright = fontToCopyright(font);
44
+ let svg = `<svg xmlns="http://www.w3.org/2000/svg"
45
+ ${widthAttribute} ${heightAttribute} viewBox="0 0 ${glyphWidth} ${glyphHeight}">
46
+ `;
47
+ if (copyright != "") {
48
+ svg += ` <!--
49
+ ${copyright}
50
+ -->
51
+ `;
52
+ }
53
+ return svg;
54
+ }
55
+ function toSVG(font, glyph, options = {}) {
56
+ const translateY = options.translateY ?? font.ascender;
57
+ const d = (0, svgpath_1.default)(glyph.path.toPathData())
58
+ .scale(1, -1)
59
+ .translate(0, Number(translateY))
60
+ .toString();
61
+ if (d == "")
62
+ return undefined;
63
+ const path = `<path d="${d}"/>`;
64
+ return svgHeader(font, glyph, options) + path + "\n</svg>";
65
+ }
66
+ exports.toSVG = toSVG;
67
+ function getInfo(hash) {
68
+ if (!hash)
69
+ return "";
70
+ const arr = Object.values(hash);
71
+ if (arr.length > 0) {
72
+ return arr[0];
73
+ }
74
+ else {
75
+ return "";
76
+ }
77
+ }
78
+ function fontToCopyright(font) {
79
+ const copyrights = font.names.copyright
80
+ ? Object.values(font.names.copyright).join("\n")
81
+ : "";
82
+ const trademarks = font.names.trademark
83
+ ? Object.values(font.names.trademark).join("\n")
84
+ : "";
85
+ const licenses = font.names.license
86
+ ? Object.values(font.names.license).join("\n")
87
+ : "";
88
+ const licenseURLs = font.names.licenseURL
89
+ ? Object.values(font.names.licenseURL).join("\n")
90
+ : "";
91
+ const infos = [copyrights, trademarks, licenses, licenseURLs];
92
+ return infos.filter((info) => info).join("\n");
93
+ }
94
+ function glyphHeader(font) {
95
+ let header = `<svg xmlns="http://www.w3.org/2000/svg">
96
+ `;
97
+ const copyright = fontToCopyright(font);
98
+ if (copyright != "") {
99
+ header += `<!--
100
+ ${copyright}
101
+ -->
102
+ `;
103
+ }
104
+ header += `
105
+ <defs>
106
+ <font name="${getInfo(font.names.fullName)}"
107
+ horiz-adv-x="${font.unitsPerEm}" vert-adv-y="${font.unitsPerEm}" >
108
+ <font-face font-family="${getInfo(font.names.fontFamily)}" font-weight="400"
109
+ font-stretch="normal"
110
+ units-per-em="${font.unitsPerEm}"
111
+ ascent="${font.ascender}"
112
+ descent="${font.descender}"/>
113
+ `;
114
+ return header;
115
+ }
116
+ function glyphFooter() {
117
+ return `
118
+ </font>
119
+ </defs>
120
+ </svg>`;
121
+ }
122
+ function toSVGFont(font, glyphs, options) {
123
+ return glyphHeader(font) + toGlyphTag(font, glyphs, options) +
124
+ glyphFooter();
125
+ }
126
+ exports.toSVGFont = toSVGFont;
127
+ function toGlyphTag(font, glyphs, options) {
128
+ const lineGap = font.tables.hhea?.lineGap ?? 0;
129
+ const height = font.ascender - font.descender + lineGap;
130
+ const existed = glyphs.filter((glyph) => glyph.unicode).map((glyph) => {
131
+ const d = glyph.path.toPathData();
132
+ if (d == "")
133
+ return undefined;
134
+ const glyphName = (glyph.name) ? `glyph-name="${glyph.name}"` : "";
135
+ return `<glyph ${glyphName} unicode="&#${glyph.unicode};"
136
+ horiz-adv-x="${glyph.advanceWidth}" vert-adv-y="${height}"
137
+ d="${d}"/>`;
138
+ }).filter((glyphTag) => glyphTag).join("\n");
139
+ if (options.removeNotdef) {
140
+ return existed;
141
+ }
142
+ else {
143
+ const notdefGlyph = font.glyphs.get(0);
144
+ const d = notdefGlyph.path.toPathData();
145
+ const notDef = `<missing-glyph glyph-name=".notdef"
146
+ horiz-adv-x="${notdefGlyph.advanceWidth}" vert-adv-y="${height}"
147
+ d="${d}"/>`;
148
+ return existed + "\n" + notDef;
149
+ }
150
+ }
151
+ exports.toGlyphTag = toGlyphTag;
152
+ function getGlyphString(options = {}) {
153
+ if (options.textFile) {
154
+ const text = dntShim.Deno.readTextFileSync(options.textFile);
155
+ return text.trimEnd().replace(/\n/g, "");
156
+ }
157
+ else if (options.codeFile) {
158
+ const text = dntShim.Deno.readTextFileSync(options.codeFile);
159
+ return text.trimEnd().split("\n")
160
+ .map((line) => String.fromCodePoint(Number(line))).join("");
161
+ }
162
+ else if (options.text) {
163
+ return options.text;
164
+ }
165
+ else if (options.code) {
166
+ return options.code.split(",")
167
+ .map((code) => String.fromCodePoint(Number(code))).join("");
168
+ }
169
+ else {
170
+ return undefined;
171
+ }
172
+ }
173
+ function filterGlyphs(font, options = {}) {
174
+ const glyphString = getGlyphString(options);
175
+ if (glyphString) {
176
+ return font.stringToGlyphs(glyphString);
177
+ }
178
+ else {
179
+ return Object.values(font.glyphs.glyphs);
180
+ }
181
+ }
182
+ exports.filterGlyphs = filterGlyphs;
183
+ function font2svg(font, options) {
184
+ const glyphs = filterGlyphs(font, options);
185
+ return glyphs.map((glyph) => {
186
+ return toSVG(font, glyph, options);
187
+ });
188
+ }
189
+ exports.font2svg = font2svg;
190
+ function ttf2svg(uint8array, options = {}) {
191
+ const font = (0, opentype_js_1.parse)(uint8array.buffer);
192
+ return font2svg(font, options);
193
+ }
194
+ exports.ttf2svg = ttf2svg;
195
+ function ttf2svgFont(uint8array, options = {}) {
196
+ const font = (0, opentype_js_1.parse)(uint8array.buffer);
197
+ return font2svgFont(font, options);
198
+ }
199
+ exports.ttf2svgFont = ttf2svgFont;
200
+ function font2svgFont(font, options = {}) {
201
+ const glyphs = filterGlyphs(font, options);
202
+ return toSVGFont(font, glyphs, options);
203
+ }
204
+ exports.font2svgFont = font2svgFont;