{"_id":"@mapbox/tiny-sdf@2.3.0","bugs":{"url":"https://github.com/mapbox/tiny-sdf/issues"},"dist":{"shasum":"d924ab814606bb2882ca18f320e139dbf3a7d33f","tarball":"http://registry-npm.ywwl.com/@mapbox/tiny-sdf/download/@mapbox/tiny-sdf-2.3.0.tgz","fileCount":5,"integrity":"sha512-gBvcNDBBB66bgQYvnaJ6Jk+VCaMmVq5+IZR2kWPisT88Z8s0kBQt6hfVi8QgRW8Vpg0UWZzBA4ZSyzHHC+VeRA==","signatures":[{"sig":"MEQCIEAaTA7uFEYgxbijMkNw1rCWWOc6e/yx5xq6nAdv9uipAiBvy+CkhaEyWi1931h5PSQbuhJ7FUskKWvobWmI4Qn8+w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDk/pNQ9k/elnxlKlBvy4dcVIZT09hp1kCghJj4C48mjAiB8NqKMxVvSMtRLjOPpWVU4HAcHpRJSFkUZgjkUNv2MDg=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mapbox%2ftiny-sdf@2.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":12970,"size":5312,"noattachment":false,"key":"/@mapbox/tiny-sdf/-/@mapbox/tiny-sdf-2.3.0.tgz"},"main":"index.js","name":"@mapbox/tiny-sdf","type":"module","author":{"name":"Vladimir Agafonkin"},"exports":"./index.js","gitHead":"f6a7992d543801228202370486f859fae019fc53","license":"BSD-2-Clause","scripts":{"test":"node --test","bench":"node bench.js","start":"st --no-cache --localhost --index index.html .","pretest":"eslint index.js index.html test"},"typings":"./index.d.ts","version":"2.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"0debb836-9edd-490d-b650-9987837bfe3d"}},"homepage":"https://github.com/mapbox/tiny-sdf#readme","keywords":["sdf","signed distance fields","font","canvas","text","distance transform"],"repository":{"url":"git+https://github.com/mapbox/tiny-sdf.git","type":"git"},"_npmVersion":"11.19.0","description":"Browser-side SDF font generator","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"},{"name":"mbx-npm-ci-staging","email":"yannick.meeus+npm+staging+ci@mapbox.com"},{"name":"mbx-npm-ci-production","email":"yannick.meeus+npm+production+ci@mapbox.com"},{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},{"name":"mbx-npm-03-production","email":"yannick.meeus+npm+prod+03@mapbox.com"},{"name":"mbx-npm-04-production","email":"yannick.meeus+npm+prod+04@mapbox.com"},{"name":"mbx-npm-05-production","email":"yannick.meeus+npm+prod+05@mapbox.com"},{"name":"mbx-npm-06-production","email":"yannick.meeus+npm+prod+06@mapbox.com"},{"name":"mbx-npm-07-production","email":"yannick.meeus+npm+prod+07@mapbox.com"},{"name":"mbx-npm-08-production","email":"yannick.meeus+npm+prod+08@mapbox.com"},{"name":"mbx-npm-09-production","email":"yannick.meeus+npm+prod+09@mapbox.com"},{"name":"mbx-npm-02-staging","email":"yannick.meeus@mapbox.com"},{"name":"mbx-npm-advanced-actions-staging","email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com"},{"name":"mbx-npm-advanced-actions-production","email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com"}],"_nodeVersion":"24.21.0","_hasShrinkwrap":false,"devDependencies":{"st":"^4.0.11","pngjs":"^7.0.0","canvas":"^3.2.3","eslint":"^10.12.0","pixelmatch":"^8.0.0","eslint-plugin-html":"^8.2.1","eslint-config-mourner":"^5.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tiny-sdf_2.3.0_1791469013312_0.8072739520908627"},"readme":"# TinySDF [![Volodymyr Agafonkin's projects](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects) [![Node](https://github.com/mapbox/tiny-sdf/actions/workflows/node.yml/badge.svg)](https://github.com/mapbox/tiny-sdf/actions/workflows/node.yml)\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":1791469013406,"_cnpm_publish_time":1791469013406,"dist-tags":{"latest":"2.3.0"}}