All Projects → yeslogic → Allsorts Tools

yeslogic / Allsorts Tools

Licence: apache-2.0
Example tools for the Allsorts font parser, shaping engine, and subsetter

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Allsorts Tools

Codeface
Typefaces for source code beautification
Stars: ✭ 5,612 (+10103.64%)
Mutual labels:  fonts
Webfont Downloader
A small web service which converts webfonts into zip archives
Stars: ✭ 23 (-58.18%)
Mutual labels:  fonts
Opendyslexic Chrome
Offical OpenDyslexic chrome extension
Stars: ✭ 36 (-34.55%)
Mutual labels:  fonts
Open Huninn Font
「jf open 粉圓」是基於 Kosugi Maru 改作, 由 justfont 設計師針對台灣日常應用加以優化的開源字型。 歡迎大家自由應用、自由優化、自由改做!
Stars: ✭ 665 (+1109.09%)
Mutual labels:  fonts
Dev Fonts
List of fonts for coding
Stars: ✭ 758 (+1278.18%)
Mutual labels:  fonts
React Native Deploy Checklist
Compilado de problemas do React Native em relação ao deploy e suas soluções
Stars: ✭ 26 (-52.73%)
Mutual labels:  fonts
Google Font Download
Locally host Google's web fonts
Stars: ✭ 619 (+1025.45%)
Mutual labels:  fonts
Art
🎨 ASCII art library for Python
Stars: ✭ 1,026 (+1765.45%)
Mutual labels:  fonts
Awesome Fonts
Curated list of fonts and everything
Stars: ✭ 798 (+1350.91%)
Mutual labels:  fonts
Webfontpicker
A bookmarklet that previews Google Fonts on a live website
Stars: ✭ 31 (-43.64%)
Mutual labels:  fonts
Nerd Fonts
Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
Stars: ✭ 31,778 (+57678.18%)
Mutual labels:  fonts
Swifticons
🎢Swift Library for Font Icons - ★ this library
Stars: ✭ 747 (+1258.18%)
Mutual labels:  fonts
Fontsource
Self-host Open Source fonts in neatly bundled NPM packages.
Stars: ✭ 836 (+1420%)
Mutual labels:  fonts
Fontpreview
Highly customizable and minimal font previewer written in bash
Stars: ✭ 661 (+1101.82%)
Mutual labels:  fonts
Adobe Japan1
The Adobe-Japan1-7 Character Collection
Stars: ✭ 38 (-30.91%)
Mutual labels:  fonts
Juliamono
repository for JuliaMono, a monospaced font with reasonable Unicode support.
Stars: ✭ 625 (+1036.36%)
Mutual labels:  fonts
Fonts
A collection of rad, open-source typefaces that everyone needs in their lives.
Stars: ✭ 24 (-56.36%)
Mutual labels:  fonts
Open Relay
Free and open source fonts from Kreative Software
Stars: ✭ 48 (-12.73%)
Mutual labels:  fonts
Fonty
Android library allowing you to easily change the typeface of your UI elements.
Stars: ✭ 38 (-30.91%)
Mutual labels:  fonts
Awesome Typography
✏︎ Curated list about digital typography 🔥
Stars: ✭ 947 (+1621.82%)
Mutual labels:  fonts


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

Available tools:

  • bitmaps — dump bitmaps from bitmap fonts
  • dump — dump font information
  • has-table — check if a font has a particular table
  • shape — apply shaping to glyphs from a font
  • subset — subset a font
  • validate — parse the supplied font, reporting any failures

bitmaps

The bitmaps tool extracts bitmaps from fonts containing glyph bitmaps in either the EBLC/EBDT or CBLC/CBDT tables.

-o is the path to the directory to write the bitmaps to. It will be created if it does not exist.

The images are written out as PNGs in a sub-directory for each strike (size). The format is {ppem_x}x{ppem_y}@{bit_depth}, the files are named {glyph_id}.png:

terminus
├── [email protected]
│  ├── 0.png
│  ├── 1.png
│  ├── 2.png
│  ├── 3.png
│  ├── 4.png
│  ├── 5.png
│  ├── 6.png
│  ├── 7.png
⋮  ⋮
├── [email protected]
│  ├── 0.png
⋮  ⋮
└── [email protected]
⋮  ⋮

Example

allsorts bitmaps -o noto-color-emoji NotoColorEmoji.ttf

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

has-table

The has-table tool checks if the supplied font file contains the table passed via the -t argument. If the font contains the table it exits with status success (0), if the font doesn't not contain the table it exits with status 1. The -p option makes the tool print the path to the font if it contains the table.

This tool is handy combined with find, to locate fonts that have the desired table.

Example

In this example, we search the current directory for files ending in ttf, otf, or otc and check to see if they contain an EBLC table. If the table is found the path to the font is printed.

find . -regextype posix-extended -type f -iregex '.*\.(ttf|otf|otc)$' -exec allsorts has-table -t EBLC -p {} \;

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

validate

The validate tool attempts to parse all the glyphs (or various DICTs in the case of CFF) in the supplied font. It reports any errors encountered but is otherwise silent. This command was useful for bulk testing Allsorts against a large repertoire of real world fonts.

Example

$ allsorts validate ../allsorts/tests/fonts/bengali/Lohit-Bengali.ttf

Bulk Validation Example

$ fd '\.(ttf|otf|ttc)$' /usr/share/fonts | sort | parallel --bar allsorts validate {}

Building and Installing

From Source

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 .

Arch Linux

There is an AUR package for allsorts-tools:

git clone https://aur.archlinux.org/allsorts-tools.git
cd allsorts-tools
makepkg -si

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].