ifont
1.0.0
인대를 지원하는 동형 아이콘 글꼴 생성기.
SVG 아이콘 목록과 해당 이름에서 단일 TTF 파일을 생성하여 각 이름을 인조에 매핑합니다.
브라우저에서도 작동합니다.
npm install --save ifont다음과 같은 CLI 명령을 사용합니다.
# Build an icon font from some SVG icons
ifont build -i resources/icons/ * .svg -o dist/IconFont.ttf
# Preview an icon font from some SVG icons
ifont preview -i resources/icons/ * .svg
# List icons by bytes needed once added to the TTF font
ifont stats -i resources/icons/ * .svg다음과 같이 프로그래밍 방식 API를 사용합니다.
import ifont from 'ifont' ;
import fs from 'node:fs' ;
// Generate a TTF font, as a Uint8Array, from some SVG icons
const ttf = ifont ( {
icons : [
{ name : 'circle' , content : '<svg>...</svg>' }
{ name : 'square' , content : '<svg>...</svg>' } ,
{ name : 'triangle' , content : '<svg>...</svg>' }
]
} ) ;
fs . writeFileSync ( 'IconFont.ttf' , ttf ) ; svg2ttf : MIT © Vitaly Puzrin