0.0.4 • Published 5 years ago
font2img v0.0.4
font2img: Font to images
Convert an *.otf font to a set of images
Install
$ npm install font2imgor
$ yarn add font2imgUsage
font2img(sourceFile, options)
const font2img = require('font2img')
font2img('./directory-to/your-font-file.otf',{
width: 100,
height: 100,
spec: 11172,
family: "your-font-family",
name: "bold-italic",
outDir: "./output/"
})Then font2img will look for the ./directory-to/your-font-file.otf, make ./output/your-font-family/bold-italic/ folder and save png files in there.
API
sourceFile
font2img will complain and throw error if the source file is not an otf file.
options
width: numberwidth of the png file (default: 100)height: numberheight of the png file (default: 100)spec: 11172 | 2780 | 2350spec of the hangul font (default: 2350)outDir: stringwhere to save the generated images (default: "./output")family: stringfont family name, e.g. 'Comic Sans' (default: "unknown-family")name: stringfont name, used to annotate styles (default: source file name without extension)unicodeName: booleanwhether to set the title of image files to the unicode. If set to true, '가' and 'A' is saved as44032.png,65.png, respectively. Otherwise, it is saved as가.png,uppercase-a.png, respectively. (default: false)