font-cmap
Parse CMap of a TrueType/OpenType font file buffer
Last updated 6 years ago by shinnn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install font-cmap 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

2 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |