{"id":16781144,"url":"https://github.com/2234839/web-font","last_synced_at":"2025-04-07T12:06:45.561Z","repository":{"id":40245879,"uuid":"248674113","full_name":"2234839/web-font","owner":"2234839","description":"字体裁剪工具","archived":false,"fork":false,"pushed_at":"2024-09-17T19:31:15.000Z","size":35866,"stargazers_count":268,"open_issues_count":1,"forks_count":20,"subscribers_count":6,"default_branch":"new","last_synced_at":"2024-10-14T07:36:51.725Z","etag":null,"topics":["fontmin","ttf","web-font"],"latest_commit_sha":null,"homepage":"https://webfont.shenzilong.cn","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2234839.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-20T05:19:32.000Z","updated_at":"2024-10-08T09:40:55.000Z","dependencies_parsed_at":"2024-10-25T18:38:05.806Z","dependency_job_id":"d96475cf-c315-487a-b29e-f23385ed4de5","html_url":"https://github.com/2234839/web-font","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2234839%2Fweb-font","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2234839%2Fweb-font/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2234839%2Fweb-font/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2234839%2Fweb-font/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2234839","download_url":"https://codeload.github.com/2234839/web-font/tar.gz/refs/heads/new","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fontmin","ttf","web-font"],"created_at":"2024-10-13T07:36:50.797Z","updated_at":"2025-04-07T12:06:45.544Z","avatar_url":"https://github.com/2234839.png","language":"TypeScript","funding_links":[],"categories":["前端 \u003ca name=\"frontend\"\u003e\u003c/a\u003e"],"sub_categories":[],"readme":"# web font 字体裁剪工具\n\n之前的版本请查看 master 分支，为了能使用 llrt ，我进行了重写，之后只维护此分支\n\n![](./doc/启动内存占用.png)\n\n上面的内存占用是空载状态下，在执行字体裁剪时会将字体加载到内存中，所以会占用更多的内存，不过 llrt 也具有 gc 功能，在内存不够用时会自动释放。\n虽然 llrt 内存占用低，但它运行速度慢，不到node的1/2。有运行速度要求的建议使用node/bun运行\n\n## 起因\n\nui 需要展现一些特定的字体，但直接引入字体包又过大，于是想到了裁剪字体，一开始想的使用「字蛛」但他是针对静态网站的，而且实际他会多出许多英文的，估计是直接将源码中存在的文字都算进去了。后来又找到阿里的「webfont」 但他的字体有限，项目又不开源，所以自己写了这个\n\n## 在线尝试\n\n- [web font 在线站点](https://webfont.shenzilong.cn/)\n\n## 目的与功能\n\n1.裁剪字体包使其仅包含选中的字体,其体积自然十分之小\n2.另外可以生成 css 直接复制可用，部署在公网便可永久访问\n\n\n## 安装与使用\n\n### 使用 node / tjs / llrt 等运行时\n\n拉取项目，并将字体文件放到项目内的 font 目录下，然后运行：\n\npnpm install \u0026\u0026 pnpm build \u0026\u0026 pnpm build_backend\n\nnode ./dist_backend/app.cjs\nllrt ./dist_backend/app.cjs\ntjs run ./dist_backend/app.cjs\n\n\n### 使用 docker 安装\n\n此镜像使用 llrt 运行时\n\nhttps://hub.docker.com/repository/docker/llej0/web-font 很小的包体积 ![alt text](doc/image.png)\n\ndocker compoose.yml\n\n```yml\nversion: '3'\nservices:\n  app:\n    image: docker.io/llej0/web-font:latest\n    ports:\n      - \"8087:8087\"\n    volumes:\n      - ./data:/home/font # 挂载本机字体目录\n    deploy:\n      resources:\n        limits:\n          memory: 900M       # 设置内存限制为900MB，根据实际需求来设置\n    restart: on-failure      # 设置重启策略为 on-failure\n\n```\n\n其中 font 目录替换成你的字体文件存放目录\n\n## 提供的服务\n\n## 鸣谢\n\n[kekee000/fonteditor-core](https://github.com/kekee000/fonteditor-core)\n\n[字体天下](http://www.fonts.net.cn/commercial-free-32767/fonts-zh-1.html)\n\n\n## License\n\nMIT © [崮生](https://shenzilong.cn/关于/mit.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2234839%2Fweb-font","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2234839%2Fweb-font","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2234839%2Fweb-font/lists"}