node font list
1.0.0
font-list es un paquete Node.js para enumerar las fuentes disponibles en su sistema.
La versión actual admite macOS , Windows y Linux .
npm install font-list const fontList = require ( 'font-list' )
fontList . getFonts ( )
. then ( fonts => {
console . log ( fonts )
} )
. catch ( err => {
console . log ( err )
} )O así en TypeScript:
import { getFonts } from 'font-list'
getFonts ( )
. then ( fonts => {
console . log ( fonts )
} )
. catch ( err => {
console . log ( err )
} ) Las fonts de valor de retorno son una matriz, parece:
[ '"Adobe Arabic"',
'"Adobe Caslon Pro"',
'"Adobe Devanagari"',
'"Adobe Fan Heiti Std"',
'"Adobe Fangsong Std"',
'Arial',
...
]
Si el nombre de la fuente contiene espacios, el nombre se envolverá en citas dobles, de lo contrario no habrá citas dobles, por ejemplo: '"Adobe Arabic"' , 'Arial' .
Si no desea que los nombres de fuentes que contengan espacios se envuelvan en cotizaciones dobles, pase el objeto Opciones con disableQuoting SET A VERDADERO al llamar al método getFonts :
const fontList = require ( 'font-list' )
fontList . getFonts ( { disableQuoting : true } )
. then ( fonts => {
console . log ( fonts )
} )
. catch ( err => {
console . log ( err )
} )