{"name":"@mapbox/tiny-sdf","version":"1.1.1","description":"Browser-side SDF font generator","main":"index.js","scripts":{"test":"eslint index.js"},"repository":{"type":"git","url":"git+https://github.com/mapbox/tiny-sdf.git"},"keywords":["sdf","signed distance fields","font","canvas","text","distance transform"],"author":{"name":"Vladimir Agafonkin"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/mapbox/tiny-sdf/issues"},"homepage":"https://github.com/mapbox/tiny-sdf#readme","devDependencies":{"eslint":"^3.12.0","eslint-config-mourner":"^2.0.1"},"eslintConfig":{"extends":"mourner"},"gitHead":"3b6df667fd157340ce3e849153a1b9d01dec0393","_id":"@mapbox/tiny-sdf@1.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Ihn1nZcGIswJ5XGbgFAvVumOgWpvIjBX9jiRlIl46uQG9vJOF51ViBYHF95rEZupuyQbEmhLaDPLQlU7fUTsBg==","shasum":"16a20c470741bfe9191deb336f46e194da4a91ff","tarball":"http://registry-npm.ywwl.com/@mapbox/tiny-sdf/download/@mapbox/tiny-sdf-1.1.1.tgz","fileCount":6,"unpackedSize":22887,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc8ClCCRA9TVsSAnZWagAAocoP/0CUuVdZWASSvF9ZKDo6\nHjudcG1xkzsVxYozeNPyvUfD87w76YUYNhOMKVoRPjLWmbEUlf0XnHa3YygI\nxm6szlGrg+nVIjbTDmO+DPUeKEoIuxED9ywHlIBPmeP1RZMXxTOWvnkPsuBk\n1euGePLlmGe3xRPgFCyEM101d8QWCUNA4ecASs2vaAZLIlrjFgy7d9/zrWmG\nrUI3fiEaD9GHgaLoo1u/yNxjrR69wWoaIUPNfpdl5UlJ1f65FD8Jfj0TWgiB\nSmTkpnDaHVENfmu/6SOZj73mjcJLJ/bl/OLta6FEiaFw0tdVsNtC4BqYvxEB\nVNiLvqI/E2fy0VgUrZ+ijbGaXSAb5m87z43DTrIxI0Q1gMw6dyHt/evgPnWx\nV9O5IkPF6owYu+o+o9m0DEZrvIGk2P0H+9P0g1jlPkD2XjouA55X8ziBesw1\n97GA/fUjSc0LNcKHVXiL6/GbG07Bo1O0siHbC3EI9uK3q0Y/TQDILCZr/3Gm\nE7AG+UN8Q2lSMRiCN1RZi//tRR+3CT04Uk6ax18FkvU1jbt45J/0QDoDFfWq\nR+NzFd4ONIxWzRSZxtPJa1RKd66/EqzmQ+9F2rHxUSL3tJz0xD6t6vcYIENA\nlfHSKy5M2bAPdgJuGb1K/2llBwAlv/1n/teJhC61iEIJcoLTi8tT4FbSKO3C\ndZ8K\r\n=excP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH8kh2gjYapA4CKYVZytrZo9G6lN+DXAdBP4KUuNltkzAiEAlz2nA2rcbHWL8Xb/kN2rA9s0U3HHF/tapVtcOY6tnv0="}],"size":9862,"noattachment":false,"key":"/@mapbox/tiny-sdf/-/@mapbox/tiny-sdf-1.1.1.tgz"},"maintainers":[{"email":"accounts@mapbox.com","name":"mapbox-admin"},{"email":"accounts+npm-mapbox-machine-user@mapbox.com","name":"mapbox-machine-user"},{"email":"accounts+npmjs@mapbox.com","name":"mapbox-npm"},{"email":"accounts+npmjs-01@mapbox.com","name":"mapbox-npm-01"},{"email":"accounts+npmjs-02@mapbox.com","name":"mapbox-npm-02"},{"email":"accounts+npmjs-03@mapbox.com","name":"mapbox-npm-03"},{"email":"accounts+npmjs-04@mapbox.com","name":"mapbox-npm-04"},{"email":"accounts+npmjs-05@mapbox.com","name":"mapbox-npm-05"},{"email":"accounts+npmjs-06@mapbox.com","name":"mapbox-npm-06"},{"email":"accounts+npmjs-07@mapbox.com","name":"mapbox-npm-07"},{"email":"accounts+npmjs-08@mapbox.com","name":"mapbox-npm-08"},{"email":"accounts+npmjs-09@mapbox.com","name":"mapbox-npm-09"},{"email":"accounts+npmjs-advanced-actions@mapbox.com","name":"mapbox-npm-advanced-actions"},{"email":"accounts+npmjs-npm-ci@mapbox.com","name":"mapbox-npm-ci"}],"_npmUser":{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-sdf_1.1.1_1559243073587_0.6605895519226548"},"_hasShrinkwrap":false,"readme":"# TinySDF [![Build Status](https://travis-ci.com/mapbox/tiny-sdf.svg?branch=main)](https://travis-ci.com/mapbox/tiny-sdf)\n\nTinySDF is a tiny and fast JavaScript library for generating SDF (signed distance field)\nfrom system fonts on the browser using Canvas 2D and\n[Felzenszwalb/Huttenlocher distance transform](https://cs.brown.edu/~pff/papers/dt-final.pdf).\nThis is very useful for [rendering text with WebGL](https://www.mapbox.com/blog/text-signed-distance-fields/).\n\n## [Demo](http://mapbox.github.io/tiny-sdf)\n\n## Usage\n\nCreate a TinySDF for drawing glyph SDFs based on font parameters:\n\n```js\nconst tinySdf = new TinySDF({\n    fontSize: 24,             // Font size in pixels\n    fontFamily: 'sans-serif', // CSS font-family\n    fontWeight: 'normal',     // CSS font-weight\n    fontStyle: 'normal',      // CSS font-style\n    buffer: 3,                // Whitespace buffer around a glyph in pixels\n    radius: 8,                // How many pixels around the glyph shape to use for encoding distance\n    cutoff: 0.25              // How much of the radius (relative) is used for the inside part of the glyph\n});\n\nconst glyph = tinySdf.draw('泽'); // draw a single character\n```\n\nReturns an object with the following properties:\n\n- `data` is a `Uint8ClampedArray` array of alpha values (0–255) for a `width` x `height` grid.\n- `width`: Width of the returned bitmap.\n- `height`: Height of the returned bitmap.\n- `glyphTop`: Maximum ascent of the glyph from alphabetic baseline.\n- `glyphLeft`: Currently hardwired to 0 (actual glyph differences are encoded in the rasterization).\n- `glyphWidth`: Width of the rasterized portion of the glyph.\n- `glyphHeight` Height of the rasterized portion of the glyph.\n- `glyphAdvance`: Layout advance.\n\nTinySDF is provided as a ES module, so it's only supported on modern browsers, excluding IE.\n\n```html\n<script type=\"module\">\nimport TinySDF from 'https://cdn.skypack.dev/@mapbox/tiny-sdf';\n...\n</script>\n```\n\nIn Node, you can't use `require` — only `import` in ESM-capable versions (v12.15+):\n\n```js\nimport TinySDF from '@mapbox/tiny-sdf';\n```\n\n## Development\n\n```bash\nnpm test  # run tests\nnpm start # start server for the demo page\n```\n\n## License\n\nThis implementation is licensed under the [BSD 2-Clause license](https://opensource.org/licenses/BSD-2-Clause). It's based directly on the algorithm published in the Felzenszwalb/Huttenlocher paper, and is not a port of the existing C++ implementation provided by the paper's authors.\n","publish_time":1559243073818,"_cnpm_publish_time":1559243073818,"dist-tags":{"latest":"2.3.0"}}