font-cmap

1.0.1 • Public • Published

font-cmap

Build Status Build status Coverage Status Dependency Status devDependency Status

Parse CMap of a TrueType/OpenType font file buffer

var fs = require('fs');
var fontCmap = require('font-cmap');
 
var buf = fs.readFileSync('bower_components/font-awesome/fonts/FontAwesome.otf');
 
fontCmap(buf); //=> {"32": 1, "168": 6, "169": 12, "174": 10, ... }

Installation

NPM version

Use npm.

npm install font-cmap

API

var fontCmap = require('font-cmap');

fontCmap(buffer)

buffer: Object (Buffer of a TrueType/OpenType font file)
Return: Object

It returns an object of a CMap table in the form:

{
  "Unicode value (integer)": "Glyph ID (integer)"
}

Here is a real-life example, the result of parsing Font Awesome CMap table.

CLI

You can use this module as a CLI tool by installing it globally.

npm install -g font-cmap

Usage

Usage1: font-cmap <font file path>
Usage2: cat <font file path> | font-cmap

Options:
--min,     -m    Minify output
--help,    -h    Print usage information
--version, -v    Print version

It prints a CMap table as a JSON string.

License

Copyright (c) 2014 Shinnosuke Watanabe

Licensed under the MIT License.

Package Sidebar

Install

npm i font-cmap

Weekly Downloads

1

Version

1.0.1

License

none

Last publish

Collaborators

  • shinnn