{"id":22115748,"url":"https://github.com/yeslogic/allsorts-tools","last_synced_at":"2025-04-06T22:08:47.115Z","repository":{"id":36259630,"uuid":"215898909","full_name":"yeslogic/allsorts-tools","owner":"yeslogic","description":"Various font tools built using Allsorts","archived":false,"fork":false,"pushed_at":"2025-03-19T05:12:25.000Z","size":376,"stargazers_count":80,"open_issues_count":4,"forks_count":12,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-30T21:06:30.972Z","etag":null,"topics":["allsorts","cli","font","font-shaping","fonts","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yeslogic.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-17T22:51:43.000Z","updated_at":"2025-03-19T05:12:26.000Z","dependencies_parsed_at":"2024-04-10T06:28:30.538Z","dependency_job_id":"b379bf41-b1d6-44a4-ab2a-684d822bcab3","html_url":"https://github.com/yeslogic/allsorts-tools","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Fallsorts-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Fallsorts-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Fallsorts-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Fallsorts-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeslogic","download_url":"https://codeload.github.com/yeslogic/allsorts-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"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":["allsorts","cli","font","font-shaping","fonts","rust"],"created_at":"2024-12-01T12:17:44.318Z","updated_at":"2025-04-06T22:08:47.097Z","avatar_url":"https://github.com/yeslogic.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/yeslogic/allsorts/raw/master/allsorts.svg?sanitize=1\" alt=\"\"\u003e\u003cbr\u003e\n  Allsorts Tools\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eFont utilities implemented using the\n  \u003ca href=\"https://github.com/yeslogic/allsorts\"\u003eAllsorts\u003c/a\u003e font parser, shaping\n  engine, and subsetter.\u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/yeslogic/allsorts-tools/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/yeslogic/allsorts-tools/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/yeslogic/allsorts-tools/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/yeslogic/allsorts-tools.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n[Allsorts](https://github.com/yeslogic/allsorts) is a font parser, shaping\nengine, and subsetter for OpenType, WOFF, and WOFF2 written entirely in Rust.\nThis repository contains tools that were developed to debug and test Allsorts\nand provide examples of its use.\n\n**Note:** These tools are for demonstration, reference, and debugging purposes.\nYou should not rely on them for production workflows.\n\n## Tools\n\nAvailable tools:\n\n* [`bitmaps`](#bitmaps) — dump bitmaps from bitmap fonts\n* [`cmap`](#cmap) — print character to glyph mappings\n* [`dump`](#dump) — dump font information\n* [`has-table`](#has-table) — check if a font has a particular table\n* [`instance`](#instance) — create a static instance of a font from a variable font\n* [`layout-features`](#layout-features) — print a list of a font's GSUB and GPOS features\n* [`shape`](#shape) — apply shaping to glyphs from a font\n* [`specimen`](#specimen) — generate a HTML font speciment for a font\n* [`subset`](#subset) — subset a font\n* [`validate`](#validate) — parse the supplied font, reporting any failures\n* [`variations`](#variations) — list the variation axes of a variable font\n* [`view`](#view) — generate SVGs from glyphs\n\n### `bitmaps`\n\nThe `bitmaps` tool extracts bitmaps from fonts containing glyph bitmaps in\neither the `EBLC`/`EBDT` or `CBLC`/`CBDT` tables.\n\n#### Options\n\n* `-o` is the path to the directory to write the bitmaps to. It will be created\n  if it does not exist.\n\n#### Description\n\nThe images are written out as PNGs in a sub-directory for each strike (size).\nThe format is `{ppem_x}x{ppem_y}@{bit_depth}`, the files are named\n`{glyph_id}.png`:\n\n    terminus\n    ├── 12x12@1\n    │  ├── 0.png\n    │  ├── 1.png\n    │  ├── 2.png\n    │  ├── 3.png\n    │  ├── 4.png\n    │  ├── 5.png\n    │  ├── 6.png\n    │  ├── 7.png\n    ⋮  ⋮\n    ├── 14x14@1\n    │  ├── 0.png\n    ⋮  ⋮\n    └── 32x32@1\n    ⋮  ⋮\n\n#### Example\n\n    allsorts bitmaps -o noto-color-emoji NotoColorEmoji.ttf\n\n### `cmap`\n\nThe `cmap` tool chooses a preferred `cmap` sub-table and dumps the character to\nglyph index entries. If the encoding of the table is Unicode then the characters\nare printed along with the code point, otherwise just the numeric value of the\ncharacter is printed.\n\n#### Options\n\n* `-f`, `--font` specifies the path to the font file.\n* `-i`, `--index` is index of the font to dump (for TTC, WOFF2) (default: 0).\n\n#### Example\n\n    $ allsorts cmap --font profontn.otb\n    cmap sub-table encoding: Unicode\n    '' U+0000 -\u003e 0\n    '' U+0001 -\u003e 1\n    '' U+0002 -\u003e 2\n    ⋮\n    '?' U+003F -\u003e 63\n    '@' U+0040 -\u003e 64\n    'A' U+0041 -\u003e 65\n    'B' U+0042 -\u003e 66\n    ⋮\n    '»' U+00BB -\u003e 187\n    '¼' U+00BC -\u003e 188\n    '½' U+00BD -\u003e 189\n    '¾' U+00BE -\u003e 190\n    '¿' U+00BF -\u003e 191\n    'À' U+00C0 -\u003e 192\n    'Á' U+00C1 -\u003e 193\n    'Â' U+00C2 -\u003e 194\n    'Ã' U+00C3 -\u003e 195\n    'Ä' U+00C4 -\u003e 196\n    ⋮\n\n\n### `dump`\n\nThe `dump` tool prints or extracts information from a font file.\n\n`allsorts dump path/to/font` prints out information about the font.\n\n#### Options\n\n* `--name` includes the metadata contained in the `name` table in the output.\n* `-c` can be used to print information about a CFF font or table not\n  wrapped in a TrueType or OpenType container.\n* `-t` extracts the named table from the supplied font. The output should be\n  redirected to a file. E.g. `allsorts dump -t glyf \u003e glyf.bin`\n* `-g` prints information about a specific glyph in a font.\n* `-l` prints out all offsets in the `loca` table in the font.\n\n#### Example\n\n    $ allsorts dump noto-subset.otd | head\n    TTF\n     - version: 0x4f54544f\n     - num_tables: 9\n\n    CFF  (checksum: 0x625ba831, offset: 156, length: 166505)\n    OS/2 (checksum: 0x9f6306c8, offset: 166664, length: 96)\n    cmap (checksum: 0x131b2742, offset: 166760, length: 274)\n    head (checksum: 0x09e560e8, offset: 167036, length: 54)\n    hhea (checksum: 0x0c1109cf, offset: 167092, length: 36)\n    hmtx (checksum: 0x1b9b0310, offset: 167128, length: 52)\n    maxp (checksum: 0x000d5000, offset: 167180, length: 6)\n    name (checksum: 0x1f3037ad, offset: 167188, length: 418)\n    post (checksum: 0xff860032, offset: 167608, length: 32)\n\n    - CFF:\n     - version: 1.0\n     - name: NotoSansJP-Regular\n     - num glyphs: 13\n     - charset: Custom\n     - variant: CID\n\n### `has-table`\n\nThe `has-table` tool checks if the supplied font file contains the table passed\nvia the `-t` argument.  If the font contains the table it exits with status\nsuccess (0), if the font does not contain the table it exits with status 1.\n\nThis tool is handy combined with `find`, to locate fonts that have the desired table.\n\n#### Options\n\n* `-t`, `--table TABLE` table to check for\n* `-i`, `--index INDEX` index of the font to check (for TTC, WOFF2) (default: 0)\n* `-p`, `--print-file` print the path to the font if it contains the table.\n* `-v`, `--invert-match` select fonts that don't have the given table\n\n#### Example\n\nIn this example, we search the current directory for files ending in `ttf`,\n`otf`, or `otc` and check to see if they contain an `EBLC` table. If the table\nis found the path to the font is printed.\n\n    find . -regextype posix-extended -type f -iregex '.*\\.(ttf|otf|otc)$' -exec allsorts has-table -t EBLC -p {} \\;\n\n### `instance`\n\nThe `instance` tool applies a set of values (tuple) to the variation axes of a\nvariable font to produce a static, non-variable font with those settings.\n\n#### Options\n\n* `-t`, `--tuple` is a comma separated list of values one for each variation axis\n  of the font. The `variations` tool will list the axes, their order, and limits.\n* `-o`, `--output` is the path to the output font.\n\n#### Example\n\nIn this example the font has two axes: `UNDO` and `UNDS`. We supply a value of\n500 for each one and write the output font to `UnderlineTest.ttf`.\n\n    allsorts instance --tuple 500,500 UnderlineTest-VF.ttf -o UnderlineTest.ttf\n\n### `layout-features`\n\nPrints an indented list of a font's GSUB and GPOS features.\n\n#### Example\n\n    $ layout-features fonts/devanagari/AnnapurnaSIL-Regular.ttf\n    Table: GSUB\n      Script: DFLT\n        Language: default\n          Feature: aalt\n            Lookups: 56\n          Feature: abvs\n            Lookups: 27,28,29,30\n          Feature: akhn\n            Lookups: 4\n          Feature: blwf\n            Lookups: 9\n    # additional output omitted\n\n### `shape`\n\nThe `shape` tool shapes the supplied text according to the supplied font, language, and\nscript. It prints out the glyphs before and after shaping.\n\n#### Options\n\n*  `-f`, `--font PATH` path to font file\n*  `-i`, `--index INDEX` index of the font to shape (for TTC, WOFF2) (default: 0)\n*  `-s`, `--script SCRIPT` script to shape\n*  `-l`, `--lang LANG` language to shape\n*  `--vertical` vertical layout, default is horizontal\n\n#### Example\n\n    $ shape -f fonts/devanagari/AnnapurnaSIL-Regular.ttf -s deva -l HIN 'शब्दों और वाक्यों की तरह'\n    # output omitted\n\n### `specimen`\n\nThe `specimen` tool generates a HTML font specimen sheet containing sample text\nset in the font as well as information about the font and its supported features.\n\n#### Options\n\n* `-i`, `--index INDEX` index of the font to subset (for TTC, WOFF2) (default: 0)\n* `--sample-text TEXT` sample text to use in the font specimen\n\n#### Example\n\n    $ allsorts specimen ../allsorts/tests/fonts/bengali/Lohit-Bengali.ttf\n\n### `subset`\n\nThe `subset` tool takes a source font and some text and writes a new version of\nthe source font only containing the glyphs required for the supplied text.\n\n#### Options\n\n* `-t`, `--text TEXT` subset the font to include glyphs from TEXT\n* `-a`, `--all` include all glyphs in the subset font\n* `-i`, `--index INDEX` index of the font to subset (for TTC, WOFF2) (default: 0)\n\n#### Example\n\n    $ allsorts subset -t 'This a subsetting test' NotoSansJP-Regular.otf noto-subset.otf\n    Number of glyphs in new font: 13\n\n### `validate`\n\nThe `validate` tool attempts to parse all the glyphs (or various DICTs in the\ncase of CFF) in the supplied font. It reports any errors encountered but is\notherwise silent. This command was useful for bulk testing Allsorts against a\nlarge repertoire of real world fonts.\n\n#### Example\n\n    $ allsorts validate ../allsorts/tests/fonts/bengali/Lohit-Bengali.ttf\n\n#### Bulk Validation Example\n\n    $ fd '\\.(ttf|otf|ttc)$' /usr/share/fonts | sort | parallel --bar allsorts validate {}\n\n### `variations`\n\nThe `variations` tool lists information about a variable font. The information\nincludes:\n\n- The variation axes with their tag, minimum, maximum, and default values.\n- Any pre-defined instances and their name and axis values.\n\n#### Example\n\nThis example prints variation information for the font at\n`../text-rendering-tests/fonts/TestHVARTwo.ttf`.\n\n    $ allsorts variations ../text-rendering-tests/fonts/TestHVARTwo.ttf\n    Axes: (2)\n\n    - wght = min: 0, max: 1000, default: 0\n    - cntr = min: 0, max: 100, default: 0\n\n    Instances:\n\n          Subfamily: ExtraLight\n    PostScript Name: TestFont-ExtraLight\n    Coordinates: [0.0, 0.0]\n\n          Subfamily: Light\n    PostScript Name: TestFont-Light\n    Coordinates: [150.0, 0.0]\n\n          Subfamily: Regular\n    PostScript Name: TestFont-Regular\n    Coordinates: [394.0, 0.0]\n\n          Subfamily: Semibold\n    PostScript Name: TestFont-Semibold\n    Coordinates: [600.0, 0.0]\n\n          Subfamily: Bold\n    PostScript Name: TestFont-Bold\n    Coordinates: [824.0, 0.0]\n\n          Subfamily: Black\n    PostScript Name: TestFont-Black\n    Coordinates: [1000.0, 0.0]\n\n          Subfamily: Black Medium Contrast\n    PostScript Name: TestFont-BlackMediumContrast\n    Coordinates: [1000.0, 50.0]\n\n          Subfamily: Black High Contrast\n    PostScript Name: TestFont-BlackHighContrast\n    Coordinates: [1000.0, 100.0]\n\n### `view`\n\nThe `view` tool shapes the supplied text or list of codepoints according to the\nsupplied font, language, and script. Then, it generates an SVG of the glyphs.\n\n#### Options\n\n* `-f`, `--font PATH` path to font file\n* `-s`, `--script SCRIPT` script to shape\n* `-l`, `--lang LANG` language to shape\n* `--mark-origin` mark the origin of each glyph with a cross-hair\n* `--margin num` or `top,right,bottom,left` specify a margin to be added to the edge of the SVG\n* `--fg-colour rrggbbaa` set the fill colour of the glyphs\n* `--bg-colour rrggbbaa` set the background colour of the generated SVG\n* `--fg-color rrggbbaa` alias for `--fg-colour`\n* `--bg-color rrggbbaa` alias for `--bg-colour`\n* `-t`, `--text TEXT` text to render\n* `-c`, `--codepoints CODEPOINTS` comma-separated list of codepoints (as hexadecimal numbers) to render\n* `-i`, `--indices GLYPH_INDICES` comma-separated list of glyph indices to render\n* `-F`, `--features FEATURES`  comma-separated list of OpenType features to enable (note: only enables these features)\n\n#### Example Using Text\n\n    $ view -f fonts/devanagari/NotoSerifDevanagari-Regular.ttf -s deva -t 'खि'\n    # output omitted\n\n#### Example Using Codepoints\n\n    $ allsorts view -f fonts/devanagari/NotoSerifDevanagari-Regular.ttf -s deva -c '916,93f'\n    # output omitted\n\n#### Example Using Glyph Indices (and Features)\n\nIn this example, the OpenType `pres` feature is enabled, which allows glyph 30\nto be replaced by its special presentation form (glyph 547).\n\n    $ view -f fonts/devanagari/NotoSerifDevanagari-Regular.ttf -s deva --features pres -i '30,54'\n    # output omitted\n\n## Building and Installing\n\n### From Source\n\n**Minimum Supported Rust Version:** 1.70.0\n\nTo build the tools ensure you have [Rust installed](https://www.rust-lang.org/tools/install).\n\n* Build: `cargo build --release`\n* Install: `cargo install --path .`\n\n### Arch Linux\n\nThere is an [AUR package for `allsorts-tools`](https://aur.archlinux.org/packages/allsorts-tools/):\n\n    git clone https://aur.archlinux.org/allsorts-tools.git\n    cd allsorts-tools\n    makepkg -si\n\n## Contributing\n\nContributions are welcome, please refer to the\n[Allsorts contributing guide](https://github.com/yeslogic/allsorts/blob/master/CONTRIBUTING.md)\nfor more details.\n\n## Code of Conduct\n\nWe aim to uphold the Rust community standards:\n\n\u003e We are committed to providing a friendly, safe and welcoming environment for\n\u003e all, regardless of gender, sexual orientation, disability, ethnicity,\n\u003e religion, or similar personal characteristic.\n\nWe follow the [Rust code of conduct](https://www.rust-lang.org/policies/code-of-conduct).\n\n## License\n\nAllsorts and these tools are distributed under the terms of the Apache License\n(Version 2.0).\n\nSee [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeslogic%2Fallsorts-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeslogic%2Fallsorts-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeslogic%2Fallsorts-tools/lists"}