Get font list in specified directory(default system fonts).
This project respect font-manager.
cf.
fontscan | font-manager | |
---|---|---|
native | No, only JS | Yes, made with C |
custom directories | Yes, you can | No, only system fonts |
accuracy | Not good | Good |
speed | Slow | Fast |
Get system fonts.
const fontscan = require('fontscan');
console.log(await fontscan.getFontList());
// output
[
FontDescriptor {
path: 'C:\\Windows\\Fonts\\AGENCYB.TTF',
postscriptName: 'AgencyFB-Bold',
family: 'Agency FB',
monospace: false,
width: 3,
weight: 700,
italic: false,
style: 'Bold'
},
FontDescriptor {
path: 'C:\\Windows\\Fonts\\AGENCYR.TTF',
postscriptName: 'AgencyFB-Reg',
family: 'Agency FB',
monospace: false,
width: 3,
weight: 400,
italic: false,
style: 'Regular'
},
... more items ]
Fonts in specified directory.
Note: We recommend that you do not specify the root directory, as custom directories are searched recursively.
const fonts = await fontscan.getDirectoryFonts('/Library/Fonts');
const fonts = await fontscan.getDirectoriesFonts([
`C:\\Users\\${username}\\Fonts`,
`D:\\Fonts`
]);
Get fontdescriptors that installed and in specified directories.
options
customDirectories
string[]
- default:
[]
onlyCustomDirectories
boolean
- default:
false
Get fontdescriptors that specified files.
fontPaths
string[]
Get fontdescriptors that in specified directory.
dirPath
string
Get fontdescriptors that in specified directories.
dirPaths
string[]
Get fontdescriptors that installed.
Font descriptor has basic font informations.
path: string
family: string
postscriptName: string
width: number
- detail microsoft document
weight: number
- detail microsoft document
style: string
- e.g.
Regular
,Bold
,Italic
,Bold italic
- e.g.
italic: boolean
monospace: boolean
- Fork
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
npm test
command and confirm that it passes - Create new Pull Request
Please tell me if my English is wrong