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,147 @@
|
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import { compress, decompress } from "wawoff2";
|
|
3
|
+
import { Font, parse } from "opentype.js";
|
|
4
|
+
import { font2svgFont, ttf2svgFont } from "../ttf2svg/mod.js";
|
|
5
|
+
import svg2ttf from "svg2ttf";
|
|
6
|
+
import ttf2eot from "ttf2eot";
|
|
7
|
+
import ttf2woff from "ttf2woff";
|
|
8
|
+
// import ttf2woff2 from "npm:ttf2woff2@5.0.0";
|
|
9
|
+
// import * as fonteditor from "npm:fonteditor-core@2.3.3"; // glyph names are lost
|
|
10
|
+
export function isOTF(uint8Array) {
|
|
11
|
+
return uint8Array[0] === 0x4F &&
|
|
12
|
+
uint8Array[1] === 0x54 &&
|
|
13
|
+
uint8Array[2] === 0x54 &&
|
|
14
|
+
uint8Array[3] === 0x4F;
|
|
15
|
+
}
|
|
16
|
+
export function isTTF(uint8Array) {
|
|
17
|
+
return uint8Array[0] === 0x00 &&
|
|
18
|
+
uint8Array[1] === 0x01 &&
|
|
19
|
+
uint8Array[2] === 0x00 &&
|
|
20
|
+
uint8Array[3] === 0x00;
|
|
21
|
+
}
|
|
22
|
+
export function isEOT(uint8Array) {
|
|
23
|
+
return uint8Array[34] === 0x4C && uint8Array[35] === 0x50;
|
|
24
|
+
}
|
|
25
|
+
export function isSVG(object) {
|
|
26
|
+
return typeof object === "string";
|
|
27
|
+
}
|
|
28
|
+
export function isWOFF(uint8Array) {
|
|
29
|
+
return uint8Array[0] === 0x77 &&
|
|
30
|
+
uint8Array[1] === 0x4F &&
|
|
31
|
+
uint8Array[2] === 0x46 &&
|
|
32
|
+
uint8Array[3] === 0x46;
|
|
33
|
+
}
|
|
34
|
+
export function isWOFF2(uint8Array) {
|
|
35
|
+
return uint8Array[0] === 0x77 &&
|
|
36
|
+
uint8Array[1] === 0x4F &&
|
|
37
|
+
uint8Array[2] === 0x46 &&
|
|
38
|
+
uint8Array[3] === 0x32;
|
|
39
|
+
}
|
|
40
|
+
// glyph names are lost
|
|
41
|
+
// difficult: OTF --> TTF
|
|
42
|
+
// easy: OTF --> SVG --> TTF
|
|
43
|
+
// export function otf2ttf(otf) {
|
|
44
|
+
// const ttfObj = fonteditor.default.otf2ttfobject(otf);
|
|
45
|
+
// const ttfBuffer = new fonteditor.default.TTFWriter().write(ttfObj);
|
|
46
|
+
// return new Uint8Array(ttfBuffer);
|
|
47
|
+
// }
|
|
48
|
+
export function otf2ttf(otf) {
|
|
49
|
+
const svg = ttf2svgFont(new Uint8Array(otf));
|
|
50
|
+
return svg2ttf(svg).buffer;
|
|
51
|
+
}
|
|
52
|
+
// // TODO: not work
|
|
53
|
+
// export function eot2ttf(eot) {
|
|
54
|
+
// const ttfObj = fonteditor.default.eot2ttf(eot.buffer);
|
|
55
|
+
// const ttfBuffer = new fonteditor.default.TTFWriter().write(ttfObj);
|
|
56
|
+
// return new Uint8Array(ttfBuffer);
|
|
57
|
+
// }
|
|
58
|
+
function getGlyphString(options) {
|
|
59
|
+
if (options.textFile) {
|
|
60
|
+
const text = dntShim.Deno.readTextFileSync(options.textFile);
|
|
61
|
+
return text.trimEnd().replace(/\n/g, "");
|
|
62
|
+
}
|
|
63
|
+
else if (options.codeFile) {
|
|
64
|
+
const text = dntShim.Deno.readTextFileSync(options.codeFile);
|
|
65
|
+
return text.trimEnd().split("\n")
|
|
66
|
+
.map((line) => String.fromCodePoint(Number(line))).join("");
|
|
67
|
+
}
|
|
68
|
+
else if (options.text) {
|
|
69
|
+
return options.text;
|
|
70
|
+
}
|
|
71
|
+
else if (options.code) {
|
|
72
|
+
return options.code.split(",")
|
|
73
|
+
.map((code) => String.fromCodePoint(Number(code))).join("");
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function getFont(fontContent) {
|
|
80
|
+
if (isSVG(fontContent)) {
|
|
81
|
+
const ttf = svg2ttf(fontContent);
|
|
82
|
+
return parse(ttf.buffer.buffer);
|
|
83
|
+
}
|
|
84
|
+
else if (isWOFF2(fontContent)) {
|
|
85
|
+
const data = await decompress(fontContent);
|
|
86
|
+
return parse(Uint8Array.from(data).buffer);
|
|
87
|
+
}
|
|
88
|
+
else if (isEOT(fontContent)) {
|
|
89
|
+
// const ttf = eot2ttf(fontContent);
|
|
90
|
+
// return parse(ttf.buffer);
|
|
91
|
+
throw new Error(".eot format input is no supported.");
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return parse(fontContent.buffer);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function convertFormat(font, format) {
|
|
98
|
+
const svg = font2svgFont(font);
|
|
99
|
+
if (format === ".svg")
|
|
100
|
+
return svg;
|
|
101
|
+
const ttf = svg2ttf(svg).buffer;
|
|
102
|
+
switch (format) {
|
|
103
|
+
case ".otf": {
|
|
104
|
+
const tempFont = parse(ttf.buffer);
|
|
105
|
+
return new Uint8Array(tempFont.toArrayBuffer());
|
|
106
|
+
}
|
|
107
|
+
case ".ttf":
|
|
108
|
+
return ttf;
|
|
109
|
+
case ".eot":
|
|
110
|
+
return ttf2eot(ttf);
|
|
111
|
+
case ".woff":
|
|
112
|
+
return ttf2woff(ttf);
|
|
113
|
+
case ".woff2":
|
|
114
|
+
// return ttf2woff2(ttf);
|
|
115
|
+
return await compress(ttf);
|
|
116
|
+
default:
|
|
117
|
+
throw new Error(`${format} is not a supported format.`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function filterGlyphs(font, options) {
|
|
121
|
+
const glyphString = getGlyphString(options);
|
|
122
|
+
if (glyphString) {
|
|
123
|
+
return font.stringToGlyphs(glyphString);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
return Object.values(font.glyphs.glyphs);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function createTemporaryFont(font, glyphs) {
|
|
130
|
+
const notdefGlyph = font.glyphs.get(0);
|
|
131
|
+
const tempFont = new Font({
|
|
132
|
+
familyName: font.names.fontFamily.en,
|
|
133
|
+
styleName: font.names.fontSubfamily.en,
|
|
134
|
+
unitsPerEm: font.unitsPerEm,
|
|
135
|
+
ascender: font.ascender,
|
|
136
|
+
descender: font.descender,
|
|
137
|
+
glyphs: [notdefGlyph, ...glyphs],
|
|
138
|
+
});
|
|
139
|
+
tempFont.names = font.names;
|
|
140
|
+
return tempFont;
|
|
141
|
+
}
|
|
142
|
+
export async function convert(fontContent, format, options) {
|
|
143
|
+
const font = await getFont(fontContent);
|
|
144
|
+
const glyphs = filterGlyphs(font, options);
|
|
145
|
+
const tempFont = createTemporaryFont(font, glyphs);
|
|
146
|
+
return await convertFormat(tempFont, format);
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/package.json
ADDED
|
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,167 @@
|
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import { parse } from "opentype.js";
|
|
3
|
+
import svgpath from "svgpath";
|
|
4
|
+
export { parse };
|
|
5
|
+
function calcLineSpace(font) {
|
|
6
|
+
const lineGap = font.tables.hhea?.lineGap ?? 0;
|
|
7
|
+
return font.ascender - font.descender + lineGap;
|
|
8
|
+
}
|
|
9
|
+
function svgHeader(font, glyph, options = {}) {
|
|
10
|
+
const widthAttribute = (options.width) ? `width="${options.width}"` : "";
|
|
11
|
+
const heightAttribute = (options.height) ? `height="${options.height}"` : "";
|
|
12
|
+
const glyphWidth = glyph.advanceWidth;
|
|
13
|
+
const glyphHeight = options.glyphHeight ?? calcLineSpace(font);
|
|
14
|
+
const copyright = fontToCopyright(font);
|
|
15
|
+
let svg = `<svg xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
${widthAttribute} ${heightAttribute} viewBox="0 0 ${glyphWidth} ${glyphHeight}">
|
|
17
|
+
`;
|
|
18
|
+
if (copyright != "") {
|
|
19
|
+
svg += ` <!--
|
|
20
|
+
${copyright}
|
|
21
|
+
-->
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
return svg;
|
|
25
|
+
}
|
|
26
|
+
export function toSVG(font, glyph, options = {}) {
|
|
27
|
+
const translateY = options.translateY ?? font.ascender;
|
|
28
|
+
const d = svgpath(glyph.path.toPathData())
|
|
29
|
+
.scale(1, -1)
|
|
30
|
+
.translate(0, Number(translateY))
|
|
31
|
+
.toString();
|
|
32
|
+
if (d == "")
|
|
33
|
+
return undefined;
|
|
34
|
+
const path = `<path d="${d}"/>`;
|
|
35
|
+
return svgHeader(font, glyph, options) + path + "\n</svg>";
|
|
36
|
+
}
|
|
37
|
+
function getInfo(hash) {
|
|
38
|
+
if (!hash)
|
|
39
|
+
return "";
|
|
40
|
+
const arr = Object.values(hash);
|
|
41
|
+
if (arr.length > 0) {
|
|
42
|
+
return arr[0];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function fontToCopyright(font) {
|
|
49
|
+
const copyrights = font.names.copyright
|
|
50
|
+
? Object.values(font.names.copyright).join("\n")
|
|
51
|
+
: "";
|
|
52
|
+
const trademarks = font.names.trademark
|
|
53
|
+
? Object.values(font.names.trademark).join("\n")
|
|
54
|
+
: "";
|
|
55
|
+
const licenses = font.names.license
|
|
56
|
+
? Object.values(font.names.license).join("\n")
|
|
57
|
+
: "";
|
|
58
|
+
const licenseURLs = font.names.licenseURL
|
|
59
|
+
? Object.values(font.names.licenseURL).join("\n")
|
|
60
|
+
: "";
|
|
61
|
+
const infos = [copyrights, trademarks, licenses, licenseURLs];
|
|
62
|
+
return infos.filter((info) => info).join("\n");
|
|
63
|
+
}
|
|
64
|
+
function glyphHeader(font) {
|
|
65
|
+
let header = `<svg xmlns="http://www.w3.org/2000/svg">
|
|
66
|
+
`;
|
|
67
|
+
const copyright = fontToCopyright(font);
|
|
68
|
+
if (copyright != "") {
|
|
69
|
+
header += `<!--
|
|
70
|
+
${copyright}
|
|
71
|
+
-->
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
header += `
|
|
75
|
+
<defs>
|
|
76
|
+
<font name="${getInfo(font.names.fullName)}"
|
|
77
|
+
horiz-adv-x="${font.unitsPerEm}" vert-adv-y="${font.unitsPerEm}" >
|
|
78
|
+
<font-face font-family="${getInfo(font.names.fontFamily)}" font-weight="400"
|
|
79
|
+
font-stretch="normal"
|
|
80
|
+
units-per-em="${font.unitsPerEm}"
|
|
81
|
+
ascent="${font.ascender}"
|
|
82
|
+
descent="${font.descender}"/>
|
|
83
|
+
`;
|
|
84
|
+
return header;
|
|
85
|
+
}
|
|
86
|
+
function glyphFooter() {
|
|
87
|
+
return `
|
|
88
|
+
</font>
|
|
89
|
+
</defs>
|
|
90
|
+
</svg>`;
|
|
91
|
+
}
|
|
92
|
+
export function toSVGFont(font, glyphs, options) {
|
|
93
|
+
return glyphHeader(font) + toGlyphTag(font, glyphs, options) +
|
|
94
|
+
glyphFooter();
|
|
95
|
+
}
|
|
96
|
+
export function toGlyphTag(font, glyphs, options) {
|
|
97
|
+
const lineGap = font.tables.hhea?.lineGap ?? 0;
|
|
98
|
+
const height = font.ascender - font.descender + lineGap;
|
|
99
|
+
const existed = glyphs.filter((glyph) => glyph.unicode).map((glyph) => {
|
|
100
|
+
const d = glyph.path.toPathData();
|
|
101
|
+
if (d == "")
|
|
102
|
+
return undefined;
|
|
103
|
+
const glyphName = (glyph.name) ? `glyph-name="${glyph.name}"` : "";
|
|
104
|
+
return `<glyph ${glyphName} unicode="&#${glyph.unicode};"
|
|
105
|
+
horiz-adv-x="${glyph.advanceWidth}" vert-adv-y="${height}"
|
|
106
|
+
d="${d}"/>`;
|
|
107
|
+
}).filter((glyphTag) => glyphTag).join("\n");
|
|
108
|
+
if (options.removeNotdef) {
|
|
109
|
+
return existed;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const notdefGlyph = font.glyphs.get(0);
|
|
113
|
+
const d = notdefGlyph.path.toPathData();
|
|
114
|
+
const notDef = `<missing-glyph glyph-name=".notdef"
|
|
115
|
+
horiz-adv-x="${notdefGlyph.advanceWidth}" vert-adv-y="${height}"
|
|
116
|
+
d="${d}"/>`;
|
|
117
|
+
return existed + "\n" + notDef;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function getGlyphString(options = {}) {
|
|
121
|
+
if (options.textFile) {
|
|
122
|
+
const text = dntShim.Deno.readTextFileSync(options.textFile);
|
|
123
|
+
return text.trimEnd().replace(/\n/g, "");
|
|
124
|
+
}
|
|
125
|
+
else if (options.codeFile) {
|
|
126
|
+
const text = dntShim.Deno.readTextFileSync(options.codeFile);
|
|
127
|
+
return text.trimEnd().split("\n")
|
|
128
|
+
.map((line) => String.fromCodePoint(Number(line))).join("");
|
|
129
|
+
}
|
|
130
|
+
else if (options.text) {
|
|
131
|
+
return options.text;
|
|
132
|
+
}
|
|
133
|
+
else if (options.code) {
|
|
134
|
+
return options.code.split(",")
|
|
135
|
+
.map((code) => String.fromCodePoint(Number(code))).join("");
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function filterGlyphs(font, options = {}) {
|
|
142
|
+
const glyphString = getGlyphString(options);
|
|
143
|
+
if (glyphString) {
|
|
144
|
+
return font.stringToGlyphs(glyphString);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return Object.values(font.glyphs.glyphs);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
export function font2svg(font, options) {
|
|
151
|
+
const glyphs = filterGlyphs(font, options);
|
|
152
|
+
return glyphs.map((glyph) => {
|
|
153
|
+
return toSVG(font, glyph, options);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
export function ttf2svg(uint8array, options = {}) {
|
|
157
|
+
const font = parse(uint8array.buffer);
|
|
158
|
+
return font2svg(font, options);
|
|
159
|
+
}
|
|
160
|
+
export function ttf2svgFont(uint8array, options = {}) {
|
|
161
|
+
const font = parse(uint8array.buffer);
|
|
162
|
+
return font2svgFont(font, options);
|
|
163
|
+
}
|
|
164
|
+
export function font2svgFont(font, options = {}) {
|
|
165
|
+
const glyphs = filterGlyphs(font, options);
|
|
166
|
+
return toSVGFont(font, glyphs, options);
|
|
167
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fontconv",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Convert and compress fonts (.ttf, .otf, .eot, .svg, .woff, .woff2).",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/marmooo/fontconv/repo.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/marmooo/fontconv/issues"
|
|
12
|
+
},
|
|
13
|
+
"main": "./script/fontconv/mod.js",
|
|
14
|
+
"module": "./esm/fontconv/mod.js",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./esm/fontconv/mod.js",
|
|
18
|
+
"require": "./script/fontconv/mod.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node test_runner.js"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"fontconv": "./esm/fontconv/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"commander": "12.0.0",
|
|
29
|
+
"opentype.js": "1.3.4",
|
|
30
|
+
"svg2ttf": "6.0.3",
|
|
31
|
+
"svgpath": "2.6.0",
|
|
32
|
+
"ttf2eot": "3.1.0",
|
|
33
|
+
"ttf2woff": "3.0.0",
|
|
34
|
+
"wawoff2": "2.0.1",
|
|
35
|
+
"@deno/shim-deno": "~0.18.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^20.9.0",
|
|
39
|
+
"picocolors": "^1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"_generatedBy": "dnt@0.40.0"
|
|
42
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dntGlobalThis = exports.Deno = void 0;
|
|
4
|
+
const shim_deno_1 = require("@deno/shim-deno");
|
|
5
|
+
var shim_deno_2 = require("@deno/shim-deno");
|
|
6
|
+
Object.defineProperty(exports, "Deno", { enumerable: true, get: function () { return shim_deno_2.Deno; } });
|
|
7
|
+
const dntGlobals = {
|
|
8
|
+
Deno: shim_deno_1.Deno,
|
|
9
|
+
};
|
|
10
|
+
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
11
|
+
function createMergeProxy(baseObj, extObj) {
|
|
12
|
+
return new Proxy(baseObj, {
|
|
13
|
+
get(_target, prop, _receiver) {
|
|
14
|
+
if (prop in extObj) {
|
|
15
|
+
return extObj[prop];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return baseObj[prop];
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
set(_target, prop, value) {
|
|
22
|
+
if (prop in extObj) {
|
|
23
|
+
delete extObj[prop];
|
|
24
|
+
}
|
|
25
|
+
baseObj[prop] = value;
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
deleteProperty(_target, prop) {
|
|
29
|
+
let success = false;
|
|
30
|
+
if (prop in extObj) {
|
|
31
|
+
delete extObj[prop];
|
|
32
|
+
success = true;
|
|
33
|
+
}
|
|
34
|
+
if (prop in baseObj) {
|
|
35
|
+
delete baseObj[prop];
|
|
36
|
+
success = true;
|
|
37
|
+
}
|
|
38
|
+
return success;
|
|
39
|
+
},
|
|
40
|
+
ownKeys(_target) {
|
|
41
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
42
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
43
|
+
const extKeysSet = new Set(extKeys);
|
|
44
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
45
|
+
},
|
|
46
|
+
defineProperty(_target, prop, desc) {
|
|
47
|
+
if (prop in extObj) {
|
|
48
|
+
delete extObj[prop];
|
|
49
|
+
}
|
|
50
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
54
|
+
if (prop in extObj) {
|
|
55
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
has(_target, prop) {
|
|
62
|
+
return prop in extObj || prop in baseObj;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { assert } from "https://deno.land/std@$STD_VERSION/assert/assert.ts";
|
|
7
|
+
*
|
|
8
|
+
* assert("hello".includes("ello")); // Doesn't throw
|
|
9
|
+
* assert("hello".includes("world")); // Throws
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function assert(expr: unknown, msg?: string): asserts expr;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assert = void 0;
|
|
4
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
5
|
+
const assertion_error_js_1 = require("./assertion_error.js");
|
|
6
|
+
/**
|
|
7
|
+
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { assert } from "https://deno.land/std@$STD_VERSION/assert/assert.ts";
|
|
12
|
+
*
|
|
13
|
+
* assert("hello".includes("ello")); // Doesn't throw
|
|
14
|
+
* assert("hello".includes("world")); // Throws
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function assert(expr, msg = "") {
|
|
18
|
+
if (!expr) {
|
|
19
|
+
throw new assertion_error_js_1.AssertionError(msg);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.assert = assert;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when an assertion fails.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { AssertionError } from "https://deno.land/std@$STD_VERSION/assert/assertion_error.ts";
|
|
7
|
+
*
|
|
8
|
+
* throw new AssertionError("Assertion failed");
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare class AssertionError extends Error {
|
|
12
|
+
/** Constructs a new instance. */
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AssertionError = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when an assertion fails.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { AssertionError } from "https://deno.land/std@$STD_VERSION/assert/assertion_error.ts";
|
|
11
|
+
*
|
|
12
|
+
* throw new AssertionError("Assertion failed");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class AssertionError extends Error {
|
|
16
|
+
/** Constructs a new instance. */
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "AssertionError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.AssertionError = AssertionError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertPath(path?: string): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
|
+
// Copyright the Browserify authors. MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.assertPath = void 0;
|
|
6
|
+
function assertPath(path) {
|
|
7
|
+
if (typeof path !== "string") {
|
|
8
|
+
throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.assertPath = assertPath;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function stripSuffix(name: string, suffix: string): string;
|
|
2
|
+
export declare function lastPathSegment(path: string, isSep: (char: number) => boolean, start?: number): string;
|
|
3
|
+
export declare function assertArgs(path: string, suffix: string): string | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
|
+
// This module is browser compatible.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.assertArgs = exports.lastPathSegment = exports.stripSuffix = void 0;
|
|
6
|
+
const assert_path_js_1 = require("./assert_path.js");
|
|
7
|
+
function stripSuffix(name, suffix) {
|
|
8
|
+
if (suffix.length >= name.length) {
|
|
9
|
+
return name;
|
|
10
|
+
}
|
|
11
|
+
const lenDiff = name.length - suffix.length;
|
|
12
|
+
for (let i = suffix.length - 1; i >= 0; --i) {
|
|
13
|
+
if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
|
|
14
|
+
return name;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return name.slice(0, -suffix.length);
|
|
18
|
+
}
|
|
19
|
+
exports.stripSuffix = stripSuffix;
|
|
20
|
+
function lastPathSegment(path, isSep, start = 0) {
|
|
21
|
+
let matchedNonSeparator = false;
|
|
22
|
+
let end = path.length;
|
|
23
|
+
for (let i = path.length - 1; i >= start; --i) {
|
|
24
|
+
if (isSep(path.charCodeAt(i))) {
|
|
25
|
+
if (matchedNonSeparator) {
|
|
26
|
+
start = i + 1;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (!matchedNonSeparator) {
|
|
31
|
+
matchedNonSeparator = true;
|
|
32
|
+
end = i + 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return path.slice(start, end);
|
|
36
|
+
}
|
|
37
|
+
exports.lastPathSegment = lastPathSegment;
|
|
38
|
+
function assertArgs(path, suffix) {
|
|
39
|
+
(0, assert_path_js_1.assertPath)(path);
|
|
40
|
+
if (path.length === 0)
|
|
41
|
+
return path;
|
|
42
|
+
if (typeof suffix !== "string") {
|
|
43
|
+
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.assertArgs = assertArgs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function _common(paths: string[], sep: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
|
+
// This module is browser compatible.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports._common = void 0;
|
|
6
|
+
function _common(paths, sep) {
|
|
7
|
+
const [first = "", ...remaining] = paths;
|
|
8
|
+
const parts = first.split(sep);
|
|
9
|
+
let endOfPrefix = parts.length;
|
|
10
|
+
let append = "";
|
|
11
|
+
for (const path of remaining) {
|
|
12
|
+
const compare = path.split(sep);
|
|
13
|
+
if (compare.length <= endOfPrefix) {
|
|
14
|
+
endOfPrefix = compare.length;
|
|
15
|
+
append = "";
|
|
16
|
+
}
|
|
17
|
+
for (let i = 0; i < endOfPrefix; i++) {
|
|
18
|
+
if (compare[i] !== parts[i]) {
|
|
19
|
+
endOfPrefix = i;
|
|
20
|
+
append = i === 0 ? "" : sep;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return parts.slice(0, endOfPrefix).join(sep) + append;
|
|
26
|
+
}
|
|
27
|
+
exports._common = _common;
|