{"name":"@mapbox/tiny-sdf","version":"1.2.4","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":"^7.0.0","eslint-config-mourner":"^2.0.1"},"eslintConfig":{"extends":"mourner"},"gitHead":"57efbf75898b79f936fb21b71a74d18f77a4d6a2","_id":"@mapbox/tiny-sdf@1.2.4","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ZueGnAllOqVdR6Bqk/Fq8ynGSTsN79ki9b9t4t3uX6CMCJRt3to+0/Ra/TE67zRpUjoyzgxA/oHuYCrqnuD7nQ==","shasum":"03b4e6ceb7bfc63e3c0d3297a16d4aa0c5d4aeaf","tarball":"http://registry-npm.ywwl.com/@mapbox/tiny-sdf/download/@mapbox/tiny-sdf-1.2.4.tgz","fileCount":7,"unpackedSize":303885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLbkJCRA9TVsSAnZWagAAycAP+QCoA7HwBJRa992ixbzk\nGpbbNT0dqSD08Z4m7Je+LUonBp5ZqZ3d/Gy04yWWJ5j/1SBG3y6PlimWNuBT\ngT7qkXbZEvMfV+rwT5+b8vtFzYeJOUmRjhiyBjFM+zsI1gFKEUvtyMHTl9uB\nJo90l7bShfek6YeJSIN33lbOnn2g43+tvPFlh5he2Lhw3ZXcbZld5okSDnTV\nCVCoif/HDeSoscc3TrscmyBSoLFo+s8Wkn36HwHcYw5PvPyHMvsV9O4wT24Y\n7ajXizU4JIZbvudCCghBCTJBB0BGMQObkB+Uknp7koOZ7R4kRcP6bkx7EDng\nabqHiSPI1n42PPGVgsfk15oqObaEXRCml/IGGWPcDPiVWTytEqVdxuCOXUot\noFVpSRRZpzuakq5vxdrRlvH9HnRbpN1Wq/9f7cMpKB784Nv3V7wjvF0S/DgX\nmaLj/RR4l4z602FHI1hs83Ld54G4jJWTeHan98mKBgDk8S/paFrbM7iVaw3j\n12pPT1X3Y+Fu1MCDV9wZ57h0sduUNMHhdRG0opMrdzxG1Mc1E8qr/O5x86Kr\nmMiuDPsjMolVayzL1J3wQHBbgBhK2nCdFIVPtsBiKP84xlEIC9VvxPk+7QUf\n/C460es/nVjkuCcSf+jf/NuYprJ6O7/GQOj5BScEphZwWuGLXzESrv5EGy/A\nnPQK\r\n=51Mq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSpNUwbS8cLGBPoaX4lyU7JitK3ArEBW1MjpYIzFk7UAIhALPe3nNxRMOxMDgeS+N5cx5rLClWVyzMNWLyUsqC1YuU"}],"size":183994,"noattachment":false,"key":"/@mapbox/tiny-sdf/-/@mapbox/tiny-sdf-1.2.4.tgz"},"_npmUser":{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},"directories":{},"maintainers":[{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},{"name":"mapbox-npm-07","email":"accounts+npmjs-07@mapbox.com"},{"name":"mapbox-npm-03","email":"accounts+npmjs-03@mapbox.com"},{"name":"mapbox-npm-04","email":"accounts+npmjs-04@mapbox.com"},{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},{"name":"mapbox-npm-05","email":"accounts+npmjs-05@mapbox.com"},{"name":"mapbox-npm-06","email":"accounts+npmjs-06@mapbox.com"},{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},{"name":"mapbox-npm-advanced-actions","email":"accounts+npmjs-advanced-actions@mapbox.com"},{"name":"mapbox-npm-ci","email":"accounts+npmjs-npm-ci@mapbox.com"},{"name":"mapbox-npm","email":"accounts+npmjs@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-sdf_1.2.4_1613609224902_0.6720072358771831"},"_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":1613609225135,"_cnpm_publish_time":1613609225135,"dist-tags":{"latest":"2.3.0"}}