{"name":"@mapbox/tiny-sdf","version":"2.0.5","description":"Browser-side SDF font generator","type":"module","main":"index.js","exports":"./index.js","typings":"./index.d.ts","scripts":{"pretest":"eslint index.js index.html test","test":"node test/test.js","start":"st --no-cache --localhost --index index.html ."},"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":{"canvas":"2.9.0","eslint":"^8.8.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^6.2.0","pixelmatch":"^5.2.1","pngjs":"^6.0.0","st":"^3.0.0","tape":"^5.5.0"},"eslintConfig":{"extends":"mourner","parserOptions":{"ecmaVersion":2020},"plugins":["html"]},"gitHead":"bd847e192f5b147d644e4fad3e0cf45e31166ea3","_id":"@mapbox/tiny-sdf@2.0.5","_nodeVersion":"14.16.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-OhXt2lS//WpLdkqrzo/KwB7SRD8AiNTFFzuo9n14IBupzIMa67yGItcK7I2W9D8Ghpa4T04Sw9FWsKCJG50Bxw==","shasum":"cdba698d3d65087643130f9af43a2b622ce0b372","tarball":"http://registry-npm.ywwl.com/@mapbox/tiny-sdf/download/@mapbox/tiny-sdf-2.0.5.tgz","fileCount":5,"unpackedSize":10743,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+RacCRA9TVsSAnZWagAA6NwP/A0vG89mzPwh9azsE/o3\nW10Aie02Pw2GuPC14gC24sOCNUpaxaY3a5lrDMuozO4i4RF1tZ62pQMHeHBo\nn1tFTUwXrxYbB5MKngHZZywszCw4lp/IKg/Xt4roJcoDImvu0NJlk8ws6sbW\nQMelCjdPP3ngMw+uM/V1QUKfUMZlO5DbfHpaMvesaSjT/lAzHoKbuIwZw/5o\nZybkwM2jBUh0VYGBLNcBKNlbp7kR992PgIW2PlowfJZ3TN6PMiUlwc9kZ3aR\nNEbQvRlZ5sn/2A/iLQK7etMksj3CHOu2Xb9uj7ImhdNFbEMd3ww+DROGfcVc\nIUATyYQFeRtueeHMsbug5F/2zHLIaYB0Bqr2/o1UxCuTg3xh4ngVDrKE5+uq\n1R1qCSddyTfxtcqGfVXUo0o6Rg7242t5sta9zVW6ybmWVplWber1XgsuHSWo\n1SRshtepQpw/yBKcHIpggZhfmQUKh6helrR7ZS+cWl3QyikQXL7vjjSf44pL\nxSmJHXvJIMTb80OdbVRBxo8uN8IXZsYPum+obIcuFWC0LIN4836eNsdeTku0\nUNZ1OT1wmWwMKltNfJZFeawSUWIFpU+/aEoDRDdcWRFwMWbjrMm8L/bmXH42\nrcxygD5JjReFI1W4122wqT0Dr4iEaWlrrnRkRSj7o0BtXuvunoGlHyc7PFlV\nRYB3\r\n=3yGG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0A/3Qgoccm+9sq6v+C6Ldc7vK8TEWlIh1//B1MScp3QIgUpbMuqb3TA+DZyVemF542x64hofQUX1v95oSZjJILkk="}],"size":4413,"noattachment":false,"key":"/@mapbox/tiny-sdf/-/@mapbox/tiny-sdf-2.0.5.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_2.0.5_1643714204398_0.19895006575199448"},"_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":1643714204545,"_cnpm_publish_time":1643714204545,"dist-tags":{"latest":"2.3.0"}}