Git Product home page Git Product logo

allsorts-tools's Introduction


Allsorts Tools

Example tools for the Allsorts font parser, shaping engine, and subsetter


Allsorts is a font parser, shaping engine, and subsetter for OpenType, WOFF, and WOFF2 written entirely in Rust. This repository contains tools that were developed to debug and test Allsorts and provide examples of its use.

Note: These tools are for demonstration and reference purposes. You should not rely on them for production workflows.

Tools

dump

The dump tool prints or extract information from a font file.

allsorts dump path/to/font prints out information about the font and meta data contained in the name table.

-c option can be used to print information about a CFF font or table not wrapped in a TrueType or OpenType container.

-t option extracts the named table from the supplied font. The output should be redirected to a file. E.g. allsorts dump -t glyf > glyf.bin

-g prints information about a specific glyph in a font.

-l option prints out all offsets in the loca table in the font.

Example

$ allsorts dump noto-subset.otd | head
TTF
 - version: 0x4f54544f
 - num_tables: 9

CFF  (checksum: 0x625ba831, offset: 156, length: 166505)
OS/2 (checksum: 0x9f6306c8, offset: 166664, length: 96)
cmap (checksum: 0x131b2742, offset: 166760, length: 274)
head (checksum: 0x09e560e8, offset: 167036, length: 54)
hhea (checksum: 0x0c1109cf, offset: 167092, length: 36)
hmtx (checksum: 0x1b9b0310, offset: 167128, length: 52)
maxp (checksum: 0x000d5000, offset: 167180, length: 6)
name (checksum: 0x1f3037ad, offset: 167188, length: 418)
post (checksum: 0xff860032, offset: 167608, length: 32)

- CFF:
 - version: 1.0
 - name: NotoSansJP-Regular
 - num glyphs: 13
 - charset: Custom
 - variant: CID

subset

The subset tool takes a source font and some text and writes a new version of the source font only containing the glyphs required for the supplied text.

Example

$ allsorts subset -t 'This a subsetting test' NotoSansJP-Regular.otf noto-subset.otf
Number of glyphs in new font: 13

shape

The shape tool shapes the supplied text according to the supplied font, language, and script. It prints out the glyphs before and after shaping.

Example

$ shape -f fonts/devanagari/AnnapurnaSIL-Regular.ttf -s deva -l HIN 'शब्दों और वाक्यों की तरह'
# output omitted

Building and Installing

Minimum Supported Rust Version: 1.38.0

To build the tools ensure you have Rust 1.38.0 or newer installed.

  • Build: cargo build --release
  • Install: cargo install --path .

Contributing

Contributions are welcome, please refer to the Allsorts contributing guide for more details.

Code of Conduct

We aim to uphold the Rust community standards:

We are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic.

We follow the Rust code of conduct.

License

Allsorts and these tools are distributed under the terms of the Apache License (Version 2.0).

See LICENSE for details.

allsorts-tools's People

Contributors

adrianwong avatar brendanzab avatar mikeday avatar simonsapin avatar wezm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.