# detect-kerning

> Calculate kerning table of a font

Latest version **2.1.2** (published 2018-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install detect-kerning
pnpm add detect-kerning
yarn add detect-kerning
bun add detect-kerning
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2018-06-20 |
| First published | 2018-06-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Dmitry Yv |
| Maintainers | dfcreative |
| Keywords | kerning, tracking, font, type, typeface, typography, typographics, kern, letter-spacing |

## Links

- npm: https://www.npmjs.com/package/detect-kerning
- Repository: https://github.com/dy/detect-kerning
- Homepage: https://github.com/dy/detect-kerning#readme
- Issues: https://github.com/dy/detect-kerning/issues
- npm.io page: https://npm.io/package/detect-kerning

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2018-06-20
- 2.1.1 — 2018-06-10
- 2.1.0 — 2018-06-10
- 2.0.0 — 2018-06-09
- 1.0.0 — 2018-06-09

## README

# detect-kerning [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dy/detect-kerning.svg)](https://travis-ci.org/dy/detect-kerning)

Calculate kerning pairs for a font.

[![npm install detect-kerning](https://nodei.co/npm/detect-kerning.png?mini=true)](https://npmjs.org/package/detect-kerning/)

```js
const kerning = require('detect-kerning')

let pairs = kerning('Roboto')

/*
{
	'A”': -10,
	'W.': -5,
	'P,': -3,
	...
}
*/

// get px kerning for 16px font-size
let px = 16 * pairs['AV'] / 1000
```

### `pairs = kerning(family|familyList, pairs|range|options?)`

Detect kerning pairs for the font family or stack of families and return their kerning in 1000 units/em. Optionally pass specific kerning pairs to check, or a unicode range, by default all printable ASCII character pairs are detected from the `[32, 126]` range. Alternatively, an options object can define:

* `options.pairs` - specific pairs to check;
* `options.range` - unicode range to detect pairs from;
* `options.fontSize` - base font size to use for check. Can affect performance, by default 16.
* `options.threshold` - font size (em) ratio to detect kerning, by default 0.05. Values below that number can bloat kerning table size.


## Related

* [css-font](https://npmjs.org/css-font) for parsing font-family from css font string.

## License

© 2018 Dmitry Yv. MIT License

---
_Source: https://npm.io/package/detect-kerning · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
