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.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/esm/_dnt.shims.d.ts +5 -0
- package/esm/_dnt.shims.js +61 -0
- package/esm/deps/deno.land/std@0.221.0/assert/assert.d.ts +12 -0
- package/esm/deps/deno.land/std@0.221.0/assert/assert.js +18 -0
- package/esm/deps/deno.land/std@0.221.0/assert/assertion_error.d.ts +14 -0
- package/esm/deps/deno.land/std@0.221.0/assert/assertion_error.js +18 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/assert_path.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/assert_path.js +7 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/basename.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/basename.js +40 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/common.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/common.js +23 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/constants.d.ts +39 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/constants.js +46 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/dirname.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/dirname.js +8 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/format.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/format.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/from_file_url.d.ts +2 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/from_file_url.js +9 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.d.ts +28 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.js +237 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/normalize.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/normalize.js +8 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/normalize_string.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/normalize_string.js +77 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/relative.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/relative.js +9 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/to_file_url.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/_common/to_file_url.js +15 -0
- package/esm/deps/deno.land/std@0.221.0/path/_interface.d.ts +38 -0
- package/esm/deps/deno.land/std@0.221.0/path/_interface.js +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/_os.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/_os.js +18 -0
- package/esm/deps/deno.land/std@0.221.0/path/basename.d.ts +17 -0
- package/esm/deps/deno.land/std@0.221.0/path/basename.js +26 -0
- package/esm/deps/deno.land/std@0.221.0/path/common.d.ts +13 -0
- package/esm/deps/deno.land/std@0.221.0/path/common.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/constants.js +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/dirname.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/dirname.js +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/extname.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/extname.js +13 -0
- package/esm/deps/deno.land/std@0.221.0/path/format.d.ts +8 -0
- package/esm/deps/deno.land/std@0.221.0/path/format.js +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/from_file_url.d.ts +18 -0
- package/esm/deps/deno.land/std@0.221.0/path/from_file_url.js +24 -0
- package/esm/deps/deno.land/std@0.221.0/path/glob_to_regexp.d.ts +62 -0
- package/esm/deps/deno.land/std@0.221.0/path/glob_to_regexp.js +65 -0
- package/esm/deps/deno.land/std@0.221.0/path/is_absolute.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/is_absolute.js +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/is_glob.d.ts +2 -0
- package/esm/deps/deno.land/std@0.221.0/path/is_glob.js +28 -0
- package/esm/deps/deno.land/std@0.221.0/path/join.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/join.js +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/join_globs.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/join_globs.js +11 -0
- package/esm/deps/deno.land/std@0.221.0/path/mod.d.ts +56 -0
- package/esm/deps/deno.land/std@0.221.0/path/mod.js +60 -0
- package/esm/deps/deno.land/std@0.221.0/path/normalize.d.ts +7 -0
- package/esm/deps/deno.land/std@0.221.0/path/normalize.js +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/normalize_glob.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/normalize_glob.js +11 -0
- package/esm/deps/deno.land/std@0.221.0/path/parse.d.ts +18 -0
- package/esm/deps/deno.land/std@0.221.0/path/parse.js +24 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/_util.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/_util.js +8 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/basename.d.ts +17 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/basename.js +27 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/common.d.ts +13 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/common.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/constants.js +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/dirname.d.ts +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/dirname.js +45 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/extname.d.ts +15 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/extname.js +68 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/format.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/format.js +11 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/from_file_url.d.ts +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/from_file_url.js +17 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.d.ts +57 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.js +69 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/is_absolute.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/is_absolute.js +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/is_glob.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/is_glob.js +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/join.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/join.js +26 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/join_globs.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/join_globs.js +26 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/mod.d.ts +38 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/mod.js +42 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/normalize.d.ts +7 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/normalize.js +25 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/normalize_glob.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/normalize_glob.js +16 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/parse.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/parse.js +98 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/relative.d.ts +7 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/relative.js +94 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/resolve.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/resolve.js +48 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/to_file_url.d.ts +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/to_file_url.js +22 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.js +10 -0
- package/esm/deps/deno.land/std@0.221.0/path/relative.d.ts +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/relative.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/resolve.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/resolve.js +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/to_file_url.d.ts +18 -0
- package/esm/deps/deno.land/std@0.221.0/path/to_file_url.js +24 -0
- package/esm/deps/deno.land/std@0.221.0/path/to_namespaced_path.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/to_namespaced_path.js +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/_util.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/_util.js +15 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/basename.d.ts +17 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/basename.js +39 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/common.d.ts +13 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/common.js +19 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/constants.js +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/dirname.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/dirname.js +98 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/extname.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/extname.js +68 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/format.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/format.js +11 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/from_file_url.d.ts +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/from_file_url.js +26 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.d.ts +57 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.js +69 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/is_absolute.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/is_absolute.js +27 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/is_glob.d.ts +1 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/is_glob.js +3 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/join.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/join.js +72 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/join_globs.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/join_globs.js +26 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/mod.d.ts +38 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/mod.js +42 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/normalize.d.ts +7 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/normalize.js +130 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/normalize_glob.d.ts +4 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/normalize_glob.js +16 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/parse.d.ts +6 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/parse.js +159 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/relative.d.ts +12 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/relative.js +121 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/resolve.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/resolve.js +143 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/to_file_url.d.ts +14 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/to_file_url.js +31 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.d.ts +5 -0
- package/esm/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.js +38 -0
- package/esm/fontconv/cli.d.ts +2 -0
- package/esm/fontconv/cli.js +36 -0
- package/esm/fontconv/mod.d.ts +10 -0
- package/esm/fontconv/mod.js +147 -0
- package/esm/fontconv/test.d.ts +1 -0
- package/esm/package.json +3 -0
- package/esm/test/bootstrap-icons.woff2 +0 -0
- package/esm/test/format-check.eot +0 -0
- package/esm/test/format-check.otf +0 -0
- package/esm/test/format-check.svg +25 -0
- package/esm/test/format-check.ttf +0 -0
- package/esm/test/format-check.woff +0 -0
- package/esm/test/format-check.woff2 +0 -0
- package/esm/test/material-icons.woff2 +0 -0
- package/esm/ttf2svg/mod.d.ts +9 -0
- package/esm/ttf2svg/mod.js +167 -0
- package/package.json +42 -0
- package/script/_dnt.shims.d.ts +5 -0
- package/script/_dnt.shims.js +65 -0
- package/script/deps/deno.land/std@0.221.0/assert/assert.d.ts +12 -0
- package/script/deps/deno.land/std@0.221.0/assert/assert.js +22 -0
- package/script/deps/deno.land/std@0.221.0/assert/assertion_error.d.ts +14 -0
- package/script/deps/deno.land/std@0.221.0/assert/assertion_error.js +22 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/assert_path.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/assert_path.js +11 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/basename.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/basename.js +46 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/common.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/common.js +27 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/constants.d.ts +39 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/constants.js +49 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/dirname.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/dirname.js +12 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/format.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/format.js +24 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/from_file_url.d.ts +2 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/from_file_url.js +13 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.d.ts +28 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/glob_to_reg_exp.js +241 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/normalize.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/normalize.js +12 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/normalize_string.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/normalize_string.js +81 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/relative.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/relative.js +13 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/strip_trailing_separators.js +23 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/to_file_url.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/_common/to_file_url.js +19 -0
- package/script/deps/deno.land/std@0.221.0/path/_interface.d.ts +38 -0
- package/script/deps/deno.land/std@0.221.0/path/_interface.js +4 -0
- package/script/deps/deno.land/std@0.221.0/path/_os.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/_os.js +44 -0
- package/script/deps/deno.land/std@0.221.0/path/basename.d.ts +17 -0
- package/script/deps/deno.land/std@0.221.0/path/basename.js +30 -0
- package/script/deps/deno.land/std@0.221.0/path/common.d.ts +13 -0
- package/script/deps/deno.land/std@0.221.0/path/common.js +23 -0
- package/script/deps/deno.land/std@0.221.0/path/constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/constants.js +9 -0
- package/script/deps/deno.land/std@0.221.0/path/dirname.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/dirname.js +16 -0
- package/script/deps/deno.land/std@0.221.0/path/extname.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/extname.js +17 -0
- package/script/deps/deno.land/std@0.221.0/path/format.d.ts +8 -0
- package/script/deps/deno.land/std@0.221.0/path/format.js +18 -0
- package/script/deps/deno.land/std@0.221.0/path/from_file_url.d.ts +18 -0
- package/script/deps/deno.land/std@0.221.0/path/from_file_url.js +28 -0
- package/script/deps/deno.land/std@0.221.0/path/glob_to_regexp.d.ts +62 -0
- package/script/deps/deno.land/std@0.221.0/path/glob_to_regexp.js +69 -0
- package/script/deps/deno.land/std@0.221.0/path/is_absolute.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/is_absolute.js +16 -0
- package/script/deps/deno.land/std@0.221.0/path/is_glob.d.ts +2 -0
- package/script/deps/deno.land/std@0.221.0/path/is_glob.js +32 -0
- package/script/deps/deno.land/std@0.221.0/path/join.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/join.js +16 -0
- package/script/deps/deno.land/std@0.221.0/path/join_globs.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/join_globs.js +15 -0
- package/script/deps/deno.land/std@0.221.0/path/mod.d.ts +56 -0
- package/script/deps/deno.land/std@0.221.0/path/mod.js +89 -0
- package/script/deps/deno.land/std@0.221.0/path/normalize.d.ts +7 -0
- package/script/deps/deno.land/std@0.221.0/path/normalize.js +18 -0
- package/script/deps/deno.land/std@0.221.0/path/normalize_glob.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/normalize_glob.js +15 -0
- package/script/deps/deno.land/std@0.221.0/path/parse.d.ts +18 -0
- package/script/deps/deno.land/std@0.221.0/path/parse.js +28 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/_util.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/_util.js +12 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/basename.d.ts +17 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/basename.js +31 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/common.d.ts +13 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/common.js +23 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/constants.js +8 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/dirname.d.ts +14 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/dirname.js +49 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/extname.d.ts +15 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/extname.js +72 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/format.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/format.js +15 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/from_file_url.d.ts +12 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/from_file_url.js +21 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.d.ts +57 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/glob_to_regexp.js +73 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/is_absolute.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/is_absolute.js +16 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/is_glob.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/is_glob.js +7 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/join.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/join.js +30 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/join_globs.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/join_globs.js +30 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/mod.d.ts +38 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/mod.js +58 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/normalize.d.ts +7 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/normalize.js +29 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/normalize_glob.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/normalize_glob.js +20 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/parse.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/parse.js +102 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/relative.d.ts +7 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/relative.js +98 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/resolve.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/resolve.js +75 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/to_file_url.d.ts +12 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/to_file_url.js +26 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/posix/to_namespaced_path.js +14 -0
- package/script/deps/deno.land/std@0.221.0/path/relative.d.ts +12 -0
- package/script/deps/deno.land/std@0.221.0/path/relative.js +23 -0
- package/script/deps/deno.land/std@0.221.0/path/resolve.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/resolve.js +18 -0
- package/script/deps/deno.land/std@0.221.0/path/to_file_url.d.ts +18 -0
- package/script/deps/deno.land/std@0.221.0/path/to_file_url.js +28 -0
- package/script/deps/deno.land/std@0.221.0/path/to_namespaced_path.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/to_namespaced_path.js +18 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/_util.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/_util.js +21 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/basename.d.ts +17 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/basename.js +43 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/common.d.ts +13 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/common.js +23 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/constants.js +8 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/dirname.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/dirname.js +102 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/extname.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/extname.js +72 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/format.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/format.js +15 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/from_file_url.d.ts +14 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/from_file_url.js +30 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.d.ts +57 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/glob_to_regexp.js +73 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/is_absolute.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/is_absolute.js +31 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/is_glob.d.ts +1 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/is_glob.js +7 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/join.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/join.js +76 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/join_globs.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/join_globs.js +30 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/mod.d.ts +38 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/mod.js +58 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/normalize.d.ts +7 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/normalize.js +134 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/normalize_glob.d.ts +4 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/normalize_glob.js +20 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/parse.d.ts +6 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/parse.js +163 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/relative.d.ts +12 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/relative.js +125 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/resolve.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/resolve.js +170 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/to_file_url.d.ts +14 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/to_file_url.js +35 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.d.ts +5 -0
- package/script/deps/deno.land/std@0.221.0/path/windows/to_namespaced_path.js +42 -0
- package/script/fontconv/cli.d.ts +2 -0
- package/script/fontconv/cli.js +61 -0
- package/script/fontconv/mod.d.ts +10 -0
- package/script/fontconv/mod.js +186 -0
- package/script/fontconv/test.d.ts +1 -0
- package/script/package.json +3 -0
- package/script/test/bootstrap-icons.woff2 +0 -0
- package/script/test/format-check.eot +0 -0
- package/script/test/format-check.otf +0 -0
- package/script/test/format-check.svg +25 -0
- package/script/test/format-check.ttf +0 -0
- package/script/test/format-check.woff +0 -0
- package/script/test/format-check.woff2 +0 -0
- package/script/test/material-icons.woff2 +0 -0
- package/script/ttf2svg/mod.d.ts +9 -0
- 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 {};
|
|
Binary file
|
|
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=""
|
|
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;
|