{"id":17472788,"url":"https://github.com/shinnn/node-font-cmap","last_synced_at":"2025-03-28T08:11:28.859Z","repository":{"id":21836288,"uuid":"25159346","full_name":"shinnn/node-font-cmap","owner":"shinnn","description":"Parse CMap of a font file buffer","archived":false,"fork":false,"pushed_at":"2015-06-29T13:17:27.000Z","size":168,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T19:32:25.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-13T13:18:04.000Z","updated_at":"2019-08-13T05:41:16.000Z","dependencies_parsed_at":"2022-08-20T00:00:45.243Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/node-font-cmap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-font-cmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-font-cmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-font-cmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fnode-font-cmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/node-font-cmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991584,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-18T17:36:32.244Z","updated_at":"2025-03-28T08:11:28.838Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","readme":"# font-cmap\n\n[![NPM version](https://img.shields.io/npm/v/font-cmap.svg)](https://www.npmjs.com/package/font-cmap)\n[![Build Status](https://travis-ci.org/shinnn/node-font-cmap.svg?branch=master)](https://travis-ci.org/shinnn/node-font-cmap)\n[![Build status](https://ci.appveyor.com/api/projects/status/71pgh750h4tnf30i?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/node-font-cmap)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/node-font-cmap.svg)](https://coveralls.io/r/shinnn/node-font-cmap)\n[![Dependency Status](https://img.shields.io/david/shinnn/node-font-cmap.svg?label=deps)](https://david-dm.org/shinnn/node-font-cmap)\n[![devDependency Status](https://img.shields.io/david/dev/shinnn/node-font-cmap.svg?label=devDeps)](https://david-dm.org/shinnn/node-font-cmap#info=devDependencies)\n\nParse [CMap](http://www.microsoft.com/typography/otspec/cmap.htm) of a TrueType/OpenType font file [buffer][buffer]\n\n```javascript\nvar fs = require('fs');\nvar fontCmap = require('font-cmap');\n\nvar buf = fs.readFileSync('bower_components/font-awesome/fonts/FontAwesome.otf');\n\nfontCmap(buf); //=\u003e {\"32\": 1, \"168\": 6, \"169\": 12, \"174\": 10, ... }\n```\n\n## Installation\n\n[Use npm](https://docs.npmjs.com/cli/install).\n\n```sh\nnpm install font-cmap\n```\n\n## API\n\n```javascript\nvar fontCmap = require('font-cmap');\n```\n\n### fontCmap(*buffer*)\n\n*buffer*: `Object` ([`Buffer`][buffer] of a TrueType/OpenType font file)  \nReturn: `Object`\n\nIt returns an object of a CMap table in the form:\n\n```javascript\n{\n  \"Unicode value (integer)\": \"Glyph ID (integer)\"\n}\n```\n\n[Here](https://raw.githubusercontent.com/shinnn/node-font-cmap/master/test/fixture.json) is a real-life example, the result of parsing [Font Awesome](https://fortawesome.github.io/Font-Awesome/) CMap table.\n\n## CLI\n\nYou can use this module as a CLI tool by installing it [globally](https://docs.npmjs.com/files/folders#global-installation).\n\n```sh\nnpm install -g font-cmap\n```\n\n### Usage\n\n```\nUsage1: font-cmap \u003cfont file path\u003e\nUsage2: cat \u003cfont file path\u003e | font-cmap\n\nOptions:\n--min,     -m    Minify output\n--help,    -h    Print usage information\n--version, -v    Print version\n```\n\nIt prints a CMap table as a [JSON](http://www.json.org/) string.\n\n## License\n\nCopyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n\n[buffer]: https://nodejs.org/api/buffer.html#buffer_buffer\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fnode-font-cmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fnode-font-cmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fnode-font-cmap/lists"}