{"_id":"@anzerwall2/font-scanner","name":"@anzerwall2/font-scanner","dist-tags":{"latest":"0.3.14"},"versions":{"0.3.14":{"name":"@anzerwall2/font-scanner","version":"0.3.14","description":"Provides access to the system font catalog","main":"index.js","types":"index.d.ts","dependencies":{"node-addon-api":"^5.0.0","node-gyp-build":"^4.8.0"},"devDependencies":{"commit-and-tag-version":"^12.0.0","mocha":"^11.0.0","node-gyp":"^11.0.0","prebuildify":"^6.0.0"},"binary":{"napi_versions":[8]},"directories":{"test":"test"},"publishConfig":{"access":"public"},"scripts":{"install":"node-gyp-build-optional","rebuild-debug":"node-gyp rebuild --debug","rebuild-release":"node-gyp rebuild","prebuildify":"prebuildify --napi --strip","release":"commit-and-tag-version && git push --follow-tags","release:patch":"commit-and-tag-version --release-as patch && git push --follow-tags","release:minor":"commit-and-tag-version --release-as minor && git push --follow-tags","release:major":"commit-and-tag-version --release-as major && git push --follow-tags","test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/AnzerWall/font-scanner.git"},"keywords":["font","find","search","substitute","enumerate"],"contributors":[{"name":"Devon Govett","email":"devongovett@gmail.com"},{"name":"Tyler Ang-Wanek","email":"tylera@axosoft.com"},{"name":"Jordan Wallet","email":"jordanw@axosoft.com"},{"name":"Jake Krammer","email":"jakek@axosoft.com"}],"license":"MIT","bugs":{"url":"https://github.com/AnzerWall/font-scanner/issues"},"homepage":"https://github.com/AnzerWall/font-scanner","_id":"@anzerwall2/font-scanner@0.3.14","gitHead":"2be00dba203d44b297cf21e1e7641a0a30729ae5","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-rsdc8UUJSfiyZO6qtXnTqJdtDw8Hk58afQuPE2JbnWvVXXZ38PhG5JtT38BF6s1SkqMtf8wysC0/C8JylmQaYQ==","shasum":"50cc760c316b947fd9cd39d9009a5d74942922ad","tarball":"https://registry.npmjs.org/@anzerwall2/font-scanner/-/font-scanner-0.3.14.tgz","fileCount":10,"unpackedSize":320858,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHXIrPNorZNdwU+/LTR20q2Z9/mo5Yu5i0LdeZxnnB0hAiEA/7rwI+MpNrpxqFsONOoIrMNWqJD8CY2rixwlhTM5Bxo="}]},"_npmUser":{"name":"takanashien","email":"295103826@qq.com"},"maintainers":[{"name":"takanashien","email":"295103826@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/font-scanner_0.3.14_1776068861376_0.20145931569371056"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-13T08:27:41.278Z","0.3.14":"2026-04-13T08:27:41.550Z","modified":"2026-04-13T08:27:41.789Z"},"maintainers":[{"name":"takanashien","email":"295103826@qq.com"}],"description":"Provides access to the system font catalog","homepage":"https://github.com/AnzerWall/font-scanner","keywords":["font","find","search","substitute","enumerate"],"repository":{"type":"git","url":"git+https://github.com/AnzerWall/font-scanner.git"},"contributors":[{"name":"Devon Govett","email":"devongovett@gmail.com"},{"name":"Tyler Ang-Wanek","email":"tylera@axosoft.com"},{"name":"Jordan Wallet","email":"jordanw@axosoft.com"},{"name":"Jake Krammer","email":"jakek@axosoft.com"}],"bugs":{"url":"https://github.com/AnzerWall/font-scanner/issues"},"license":"MIT","readme":"# @anzerwall2/font-scanner\n\nA C++ module for Node.js providing access to the system font catalog. Forked from https://github.com/foliojs/font-manager\n\n## Features\n\n* List all available fonts\n* Find fonts with specified characteristics\n* Font substitution when characters are missing\n\n## Platforms\n\n* Mac OS X 10.5 and later supported via [CoreText](https://developer.apple.com/library/mac/documentation/Carbon/reference/CoreText_Framework_Ref/_index.html)\n* Windows 7 and later supported via [DirectWrite](http://msdn.microsoft.com/en-us/library/windows/desktop/dd368038(v=vs.85).aspx)\n* Linux supported via [fontconfig](http://www.freedesktop.org/software/fontconfig)\n\n## Installation\n\nInstallation of the `@anzerwall2/font-scanner` module is via npm:\n\n  npm install --save-dev @anzerwall2/font-scanner\n\nOn Linux, you also may need to install the `libfontconfig-dev` package, for example:\n\n    sudo apt-get install libfontconfig-dev\n\n## API\n\nYou load the `@anzerwall2/font-scanner` module using `require` as with all Node modules:\n\n```javascript\nvar fontManager = require('@anzerwall2/font-scanner');\n```\n\nAll of the methods exported by `@anzerwall2/font-scanner` have both synchronous and asynchronous versions available.\nYou should generally prefer the asynchronous version as it will allow your program to continue doing other\nprocessing while a request for fonts is processing in the background, which may be expensive depending on\nthe platform APIs that are available.\n\n- [@anzerwall2/font-scanner](#anzerwall2font-scanner)\n  - [Features](#features)\n  - [Platforms](#platforms)\n  - [Installation](#installation)\n  - [API](#api)\n    - [getAvailableFonts()](#getavailablefonts)\n    - [findFonts(fontDescriptor)](#findfontsfontdescriptor)\n    - [findFont(fontDescriptor)](#findfontfontdescriptor)\n    - [substituteFont(postscriptName, text)](#substitutefontpostscriptname-text)\n    - [Font Descriptor](#font-descriptor)\n      - [Weights](#weights)\n      - [Widths](#widths)\n  - [License](#license)\n\n### getAvailableFonts()\n\nReturns an array of all [font descriptors](#font-descriptor) available on the system.\n\n```javascript\n// asynchronous API\nfontManager.getAvailableFonts().then((fonts) => { ... });\n\n// synchronous API\nvar fonts = fontManager.getAvailableFontsSync();\n\n// output\n[ { path: '/Library/Fonts/Arial.ttf',\n    postscriptName: 'ArialMT',\n    family: 'Arial',\n    style: 'Regular',\n    weight: 400,\n    width: 5,\n    italic: false,\n    monospace: false },\n  ... ]\n```\n\n### findFonts(fontDescriptor)\n\nReturns an array of [font descriptors](#font-descriptor) matching a query\n[font descriptor](#font-descriptor).\nThe returned array may be empty if no fonts match the font descriptor.\n\n```javascript\n// asynchronous API\nfontManager.findFonts({ family: 'Arial' }).then((fonts) => { ... });\n\n// synchronous API\nvar fonts = fontManager.findFontsSync({ family: 'Arial' });\n\n// output\n[ { path: '/Library/Fonts/Arial.ttf',\n    postscriptName: 'ArialMT',\n    family: 'Arial',\n    style: 'Regular',\n    weight: 400,\n    width: 5,\n    italic: false,\n    monospace: false },\n  { path: '/Library/Fonts/Arial Bold.ttf',\n    postscriptName: 'Arial-BoldMT',\n    family: 'Arial',\n    style: 'Bold',\n    weight: 700,\n    width: 5,\n    italic: false,\n    monospace: false } ]\n```\n\n### findFont(fontDescriptor)\n\nReturns a single [font descriptors](#font-descriptor) matching a query\n[font descriptors](#font-descriptor) as well as possible. This method\nalways returns a result (never `null`), so sometimes the output will not\nexactly match the input font descriptor if not all input parameters\ncould be met.\n\n```javascript\n// asynchronous API\nfontManager.findFont({ family: 'Arial', weight: 700 }).then((font) => { ... });\n\n// synchronous API\nvar font = fontManager.findFontSync({ family: 'Arial', weight: 700 });\n\n// output\n{ path: '/Library/Fonts/Arial Bold.ttf',\n  postscriptName: 'Arial-BoldMT',\n  family: 'Arial',\n  style: 'Bold',\n  weight: 700,\n  width: 5,\n  italic: false,\n  monospace: false }\n```\n\n### substituteFont(postscriptName, text)\n**NOTE: This seems to be producing unstable results on Windows at the moment when the test suite is run. Be cautious.**\n\nSubstitutes the font with the given `postscriptName` with another font\nthat contains the characters in `text`.  If a font matching `postscriptName`\nis not found, a font containing the given characters is still returned.  If\na font matching `postscriptName` *is* found, its characteristics (bold, italic, etc.)\nare used to find a suitable replacement.  If the font already contains the characters\nin `text`, it is not replaced and the font descriptor for the original font is returned.\n\n```javascript\n// asynchronous API\nfontManager.substituteFont('TimesNewRomanPSMT', '汉字').then((font) => { ... });\n\n// synchronous API\nvar font = fontManager.substituteFontSync('TimesNewRomanPSMT', '汉字');\n\n// output\n{ path: '/Library/Fonts/Songti.ttc',\n  postscriptName: 'STSongti-SC-Regular',\n  family: 'Songti SC',\n  style: 'Regular',\n  weight: 400,\n  width: 5,\n  italic: false,\n  monospace: false }\n```\n\n### Font Descriptor\n\nFont descriptors are normal JavaScript objects that describe characteristics of\na font.  They are passed to the `findFonts` and `findFont` methods and returned by\nall of the methods.  Any combination of the fields documented below can be used to\nfind fonts, but all methods return full font descriptors.\n\nName             | Type    | Description\n---------------- | ------- | -----------\n`path`           | string  | The path to the font file in the filesystem. **(not applicable for queries, only for results)**\n`postscriptName` | string  | The PostScript name of the font (e.g `'Arial-BoldMT'`). This uniquely identities a font in most cases.\n`family`         | string  | The font family name (e.g `'Arial'`)\n`style`          | string  | The font style name (e.g. `'Bold'`)\n`weight`         | number  | The font weight (e.g. `400` for normal weight). Should be a multiple of 100, between 100 and 900. See [below](#weights) for weight documentation.\n`width`          | number  | The font width (e.g. `5` for normal width). Should be an integer between 1 and 9. See [below](#widths) for width documentation.\n`italic`         | boolean | Whether the font is italic or not.\n`monospace`      | boolean | Whether the font is monospace or not.\n\n#### Weights\n\nValue | Name\n----- | -------------------------\n100   | Thin\n200   | Ultra Light\n300   | Light\n400   | Normal\n500   | Medium\n600   | Semi Bold\n700   | Bold\n800   | Ultra Bold\n900   | Heavy\n\n#### Widths\n\nValue | Name\n----- | -----------------------------\n1     | Ultra Condensed\n2     | Extra Condensed\n3     | Condensed\n4     | Semi Condensed\n5     | Normal\n6     | Semi Expanded\n7     | Expanded\n8     | Extra Expanded\n9     | Ultra Expanded\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-e861d06743450dd7a6ded8b05ea58041"}