Skip to content

Releases: adam-rocska/font-anatomy-typescript

1.1.1

12 Aug 09:22
3e3d0bf
Compare
Choose a tag to compare

1.1.1

A match release addressing dependency related cleanups.

Patch Changes

  • Removed the accidental add dependency.
  • Moved @types/node to devDependencies.

1.1.0

11 Aug 08:05
246bc83
Compare
Choose a tag to compare

1.1.0

A handful of features.

Minor Changes

  • Added fromFontBinary to support font anatomy creation
    directly from binary data.
  • Added a FontAnatomyInstance utility class to help with
    font anatomy JSON stringification when it has a Font
    instance associated with it. This was necessary to simplify
    the JSON stringification process, because OpenType.JS has
    a circular reference in its Font class, which causes
    JSON.stringify to fail.
  • Added wOF2 support.
  • Added an optional font field to the FontAnatomy type,
    for the cases when it is known, it can be carried around
    with the anatomy.
  • Exposed ExpressibleAsNumber to help with the
    implementations of more complex use cases.

Patch Changes

  • Occasionally to use void type instead of undefined
    which messed around with TypeScript conventions. They
    practically are the same (sadly) in this stack, but hey,
    play along. Now they're all undefined.
  • Added some more keywords, dunno if it matters though.

1.0.0

09 Aug 23:51
1368345
Compare
Choose a tag to compare

1.0.0

Initial release.
Enjoy.

Features

Get the anatomy of a font file

import { fromFontFile } from '@adam-rocska/font-anatomy';

// It takes a `PathLike` so you can pass a string, URL or a `Buffer`
const fontAnatomy = fromFontFile('path/to/font.ttf');

relativize

Utility for when you need a font anatomy object who's values
are relative to one of its properties.

import { relativize } from '@adam-rocska/font-anatomy';

relativize('unitsPerEm', {
  unitsPerEm: 1000,
  ascender: 800,
  descender: -200,
  xHeight: 500,
  capHeight: 700
});

will yield

{
  unitsPerEm: 1,
  ascender: 0.8,
  descender: -0.2,
  xHeight: 0.5,
  capHeight: 0.7,
}