{"id":21301748,"url":"https://github.com/funbox/beatrix","last_synced_at":"2025-06-16T00:07:27.636Z","repository":{"id":42628846,"uuid":"298284873","full_name":"funbox/beatrix","owner":"funbox","description":"A tool to chop off useless fonts glyphs and convert TTF/OTF into WOFF \u0026 WOFF2","archived":false,"fork":false,"pushed_at":"2023-07-19T02:40:51.000Z","size":1666,"stargazers_count":48,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-01T19:59:19.842Z","etag":null,"topics":["font-converter","fonttools","glyphs","otf","subset","ttf","ttf2woff","ttf2woff2","webfonts","woff","woff2"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-24T13:18:31.000Z","updated_at":"2025-04-12T21:34:57.000Z","dependencies_parsed_at":"2023-02-08T12:16:36.169Z","dependency_job_id":"6c01b860-2349-4ef0-b55b-d8636bf979d5","html_url":"https://github.com/funbox/beatrix","commit_stats":{"total_commits":49,"total_committers":5,"mean_commits":9.8,"dds":"0.18367346938775508","last_synced_commit":"6b564fd0e2944f5b8164a111ec455702c59231ba"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/funbox/beatrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Fbeatrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Fbeatrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Fbeatrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Fbeatrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funbox","download_url":"https://codeload.github.com/funbox/beatrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funbox%2Fbeatrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260072647,"owners_count":22954916,"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":["font-converter","fonttools","glyphs","otf","subset","ttf","ttf2woff","ttf2woff2","webfonts","woff","woff2"],"created_at":"2024-11-21T15:50:42.051Z","updated_at":"2025-06-16T00:07:27.605Z","avatar_url":"https://github.com/funbox.png","language":"JavaScript","funding_links":[],"categories":["JavaScript libs"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo-top.svg\" alt=\"Beatrix logo: “BEATRIX” cut into two pieces by katana\" /\u003e\n\u003c/div\u003e \n\n\u003cdiv align=\"center\"\u003e\n  \u003cb\u003eBeatrix\u003c/b\u003e chops off useless fonts parts and converts TTF/OTF files into WOFF \u0026 WOFF2\n\u003c/div\u003e \n\n## Rationale\n\nUsers spend a lot of time downloading web assets: JS, CSS, images, fonts, etc.\nTo reduce waiting time, developers compress the assets, gzip them, use optimized formats for images and fonts.\n\nBut sometimes the developers can go a little bit further. When they have all the rights for fonts they use,\nit's possible to leave only the glyphs their website needs. Just cut off the rest ones.\n\nThat's exactly how the tool works.\n\n## Getting Started\n\n[По-русски](./README.ru.md)\n\nFirst of all, the tool is a wrapper around Python scripts distributed as [fonttools](https://github.com/fonttools/fonttools).\nYou should install them and the deps they need to:\n\n```sh\npip install fonttools zopfli brotli\n```\n\nThen you can install Beatrix:\n\n```sh\nnpm install --save @funboxteam/beatrix\n```\n\nNow you're ready to optimize your fonts.\n\n## Usage\n\nBeatrix expects to get a path to directory with TTF/OTF files inside and the config with allowed characters listed.\n\nE.g. if you clone this repo and install the tool, you will be able to run it like this:\n\n```sh\nbeatrix --config ./example/config.js --output ./dist ./example\n``` \n\nIt will load `./example/config.js`, find all the TTF/OTF files inside `./example`, optimize \u0026 convert them to WOFF \u0026 WOFF2,\nand put the results into `./dist`.\n\n\u003cdetails\u003e\n\u003csummary\u003eThe output of this command\u003c/summary\u003e\n\n```text\n$ beatrix --config ./example/config.js --output ./dist ./example\nOutput dir cleared.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/bold--italic.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 171 Kb → 33 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/bold--italic.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/bold.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 167 Kb → 32 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/bold.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/light--italic.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 173 Kb → 34 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/light--italic.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/light.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 167 Kb → 32 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/light.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/regular--italic.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 170 Kb → 33 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/regular--italic.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/regular.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 168 Kb → 32 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/regular.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/thin--italic.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 172 Kb → 34 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/thin--italic.ttf'.\n------------------------\nStart processing '/tmp/beatrix/example/Roboto/thin.ttf'...\nDest dir created: '/tmp/beatrix/dist/Roboto'.\nTTF subset: 168 Kb → 32 Kb (−80%).\nTTF created.\nWOFF created.\nWOFF2 created.\nCompleted processing '/tmp/beatrix/example/Roboto/thin.ttf'.\n------------------------\nDone.\n```\n\u003c/details\u003e\n\n### Config file\n\nConfig is a JS or JSON file which describes an object containing `CHARACTERS` and `LAYOUT_FEATURES`.\n\n`CHARACTERS` is an array, where each item is a string describing one Unicode number or a range of them. \nEach Unicode number is represented as 4 hex digits.\n\n`LAYOUT_FEATURES` is an array of [OpenType features](https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist) (e.g., `kern`, `liga`, `tnum`, etc.).\n\n**Please note** that if no config provided, the [default config](lib/default-config.js) is used. If one of the options is not present in the config, the appropriate option from the default config is used.\n\nExample:\n\n```js\nmodule.exports = {\n  CHARACTERS: [\n    // Unicode range from U+0020 to U+007E (including the last one).\n    // Contains: space, !, \", #, $, %, \u0026, ', (, ), *, +, comma, \n    // -, dot, /, numbers, :, ;, \u003c, =, \u003e, ?, @, A-Z, [, \\, ], ^,\n    // _, `, a-z, {, |, }, ~\n    '0020-007E',\n\n    // One Unicode number\n    // non-breaking space\n    '00A0',\n\n    // One more Unicode number\n    // ©\n    '00A9',\n \n    // ...\n  ],\n\n  // Drop all the features except 'tnum' and 'kern'\n  LAYOUT_FEATURES: ['tnum', 'kern']\n}\n```\n\nThe characters and features described above will be left in the font files, all the rest will be cut off.\n\nIf you want to remove all the characters or features completely just pass an empty array.\n\n[![Sponsored by FunBox](logo-bottom.svg)](https://funbox.ru)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunbox%2Fbeatrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffunbox%2Fbeatrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunbox%2Fbeatrix/lists"}