Socket
Book a DemoInstallSign in
Socket

font-list-spc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

font-list-spc

list system fonts using registry and not powershell

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

font-list

font-list is a Node.js package for listing the fonts available on your system.

Current version supports MacOS, Windows, and Linux.

Powershell has been found to not return on all windows platforms

Moved call to registry. Leave powershell option as needed

//using registry
require('./index').getFonts({disableQuoting: true})
  .then(fonts => {
    console.log(fonts)
    console.log(fonts.join('\n'))
  })
  .catch(err => {
    console.log(err)
  })
console.log('*** using power shell...')
require('./index').getFonts({disableQuoting: true, usePowerShell: true})
    .then(fonts => {
        console.log(fonts)
        console.log(fonts.join('\n'))
    })
    .catch(err => {
        console.log(err)
    })

Install

npm install font-list

Usage

const fontList = require('font-list')

fontList.getFonts()
  .then(fonts => {
    console.log(fonts)
  })
  .catch(err => {
    console.log(err)
  })

The return value fonts is an Array, looks like:

[ '"Adobe Arabic"',
  '"Adobe Caslon Pro"',
  '"Adobe Devanagari"',
  '"Adobe Fan Heiti Std"',
  '"Adobe Fangsong Std"',
  'Arial',
  ...
  ]

If the font name contains spaces, the name will be wrapped in double quotes, otherwise there will be no double quotes, for example: '"Adobe Arabic"', 'Arial'.

If you don't want font names that contains spaces to be wrapped in double quotes, pass the options object with disableQuoting set to true when calling the method getFonts:

const fontList = require('font-list')

fontList.getFonts({ disableQuoting: true })
  .then(fonts => {
    console.log(fonts)
  })
  .catch(err => {
    console.log(err)
  })

Keywords

font

FAQs

Package last updated on 09 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.