Giter Club home page Giter Club logo

font's Introduction

font

Build Status GoDoc

A collection of Go packages for parsing and encoding OpenType fonts.

The main contribution of this repository is the SFNT library which provides support for parsing OpenType, TrueType, WOFF, and WOFF2 fonts.

Also included is a utility called font that can do various useful things with fonts:

go get -u github.com/ConradIrwin/font/cmd/font

Info gets information about the font from the name table:

font info ~/Downloads/Fanwood.ttf

Scrub empties the name table (which can give you a few kb savings, even if you gzip or woff2-encode your font).

font scrub ~/Downloads/Fanwood.ttf

Stats tells you how much space each table is using:

font stats ~/Downloads/Fanwood.ttf

TODO

Still missing is support for parsing EOT files (which should be easy to add). Also support for generating WOFF files (which is annoyingly fiddly due to the checksum calculation) and WOFF2 files (needs a Brotli encoder), and a whole load of code around dealing with the hundreds of other SFNT table formats.

Font file formats

On the web there are five main types of font file, TrueType, OpenType, WOFF, WOFF2, and EOT. They all represent the same SFNT information, but are encoded slightly differently. You may also come across SVG fonts, which are a totally different beast.

Inside one of these files, there are two main types of glyphs, TrueType and OpenType (also known as PostScript Type 2, or CFF). There are also a series of supporting tables which contain meta-data about the font (its Name, Copyright Information, Kerning tweaks, Ligatures, etc.etc.)

To confuse things further, OpenType fonts use exactly the same format as TrueType fonts, and a WOFF file can contain an OpenType glyphs or a TrueType glyphs. There's no good solution to the ambiguity in terminolgy, just be aware of it.

License

Copyright (c) Conrad Irwin 2015, MIT license. See LICENSE.MIT for details

font's People

Contributors

conradirwin avatar bramp avatar dmitshur avatar neilpa avatar npillmayer avatar

Watchers

James Cloos 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.