lottery
🎉🌟✨🎈年会抽奖程序,基于 Express + Three.js的 3D 球体抽奖程序,奖品🧧🎁,文字,图片,抽奖规则均可配置,😜抽奖人员信息Excel一键导入😍,抽奖结果Excel导出😎,给你的抽奖活动带来全新酷炫体验🚀🚀🚀
Get the list of fonts installed in the system.
git clone https://github.com/oldj/node-font-list.gitoldj/node-font-listA Node.js package for listing system fonts with support for both CommonJS and ES modules.
npm install font-list
const { getFonts } = require('font-list')
getFonts()
.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.error(err)
})
import { getFonts } from 'font-list'
const fonts = await getFonts()
console.log(fonts)
import { getFonts, FontInfo } from 'font-list'
const fonts: string[] = await getFonts()
const detailedFonts: FontInfo[] = await getFonts2()
getFonts(options?)Returns a list of font family names available on the system.
Parameters:
options (optional): Configuration object
disableQuoting (boolean): If true, font names with spaces won't be wrapped in quotes. Default: falseReturns: Promise<string[]>
Example output:
[ '"Adobe Arabic"', '"Adobe Caslon Pro"', 'Arial', 'Helvetica', ... ]
Usage examples:
// Default behavior (with quotes for names containing spaces)
const fonts = await getFonts()
// Result: ['"Adobe Arabic"', 'Arial', ...]
// Disable quoting
const fonts = await getFonts({ disableQuoting: true })
// Result: ['Adobe Arabic', 'Arial', ...]
getFonts2(options?)Returns detailed font information including both family names and PostScript names.
Parameters:
options (optional): Same as getFonts()
disableQuoting (boolean): Default: falseReturns: Promise<FontInfo[]>
FontInfo interface:
interface FontInfo {
name: string // Original family name
familyName: string // Standardized family name
postScriptName: string // PostScript name
weight: string // Font weight (ultralight, light, regular, medium, semibold, bold, heavy)
style: string // Font style (normal, italic, oblique)
width: string // Font width (condensed, normal, expanded)
monospace: boolean // Whether the font is monospaced
}
Example output:
[
{
name: 'Adobe Arabic',
familyName: '"Adobe Arabic"',
postScriptName: 'AdobeArabic-Regular',
weight: 'regular',
style: 'normal',
width: 'normal',
monospace: false
},
{
name: 'Arial',
familyName: 'Arial',
postScriptName: 'ArialMT',
weight: 'regular',
style: 'normal',
width: 'normal',
monospace: false
},
{
name: 'Courier New',
familyName: '"Courier New"',
postScriptName: 'CourierNewPSMT',
weight: 'regular',
style: 'normal',
width: 'normal',
monospace: true
},
...
]
Usage examples:
// Get detailed font information
const detailedFonts = await getFonts2()
console.log(detailedFonts[0].familyName) // "Adobe Arabic"
console.log(detailedFonts[0].postScriptName) // AdobeArabic-Regular
console.log(detailedFonts[0].weight) // regular
console.log(detailedFonts[0].style) // normal
console.log(detailedFonts[0].width) // normal
console.log(detailedFonts[0].monospace) // false
// With disabled quoting
const detailedFonts = await getFonts2({ disableQuoting: true })
console.log(detailedFonts[0].familyName) // Adobe Arabic
// Filter monospace fonts
const monospaceFonts = detailedFonts.filter(font => font.monospace)
console.log(monospaceFonts.map(f => f.familyName))
// Filter bold fonts
const boldFonts = detailedFonts.filter(font => font.weight === 'bold')
console.log(boldFonts.map(f => f.familyName))
| Platform | Method | Implementation |
|---|---|---|
| macOS | system_profiler |
Uses system font database |
| Windows | PowerShell/VBS | Registry and system font queries |
| Linux | fc-list |
Fontconfig library |
This package supports both CommonJS and ES modules through dual package exports:
// CommonJS
const { getFonts, getFonts2 } = require('font-list')
// ES Modules
import { getFonts, getFonts2 } from 'font-list'
// Default export (ES Modules)
import fontList from 'font-list'
const fonts = await fontList.getFonts()
try {
const fonts = await getFonts()
console.log(`Found ${fonts.length} fonts`)
} catch (error) {
console.error('Failed to get fonts:', error.message)
}
Contributions are welcome! Please feel free to submit a Pull Request.
The macOS implementation includes a native Objective-C helper binary at
libs/darwin/fontlist. The binary is kept in git so macOS users can clone the
repository and run it without a local build step. It supports two modes: no
arguments prints the simple family-name list, while --detail (or -d) prints
a JSON array with weight/style/width/monospace metadata.
If you change libs/darwin/fontlist.m, rebuild the helper binary on macOS
before submitting the change:
npm run build:darwin
This command requires macOS and Xcode Command Line Tools. It produces a
universal binary with x86_64 and arm64 slices and a default macOS
deployment target of 11.0. Set MACOSX_DEPLOYMENT_TARGET before running the
command to override the target for a release build. Windows and Linux
contributors do not need to run it for JavaScript, type definition,
documentation, or platform-specific changes outside libs/darwin.
Pull requests should include the Darwin binary diff only when the Objective-C source file changed.
Releases should be published from macOS. npm publish runs prepublishOnly,
which rebuilds the Darwin helper binary before the package is packed and
published.
To inspect the package contents before publishing, run:
npm run pack:check
MIT © oldj
more like this
🎉🌟✨🎈年会抽奖程序,基于 Express + Three.js的 3D 球体抽奖程序,奖品🧧🎁,文字,图片,抽奖规则均可配置,😜抽奖人员信息Excel一键导入😍,抽奖结果Excel导出😎,给你的抽奖活动带来全新酷炫体验🚀🚀🚀
Convert Chinese Characters to Single-Line Fonts using Computer Vision
search projects, people, and tags