• Stars
    star
    520
  • Rank 85,117 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SVG -> TTF font convertor

svg2ttf

CI NPM version

Converts SVG fonts to TTF format. It was initially written for Fontello, but you can find it useful for your projects.

For developpers:

Internal API is similar to FontForge's one. Since primary goal is generating iconic fonts, sources can lack some specific TTF/OTF features, like kerning and so on. Anyway, current code is a good base for development, because it will save you tons of hours to implement correct writing & optimizing TTF tables.

Using from CLI

Install:

npm install -g svg2ttf

Usage example:

svg2ttf fontello.svg fontello.ttf

API

svg2ttf(svgFontString, options) -> buf

  • svgFontString - SVG font content
  • options
    • copyright - copyright string (optional)
    • description - description string (optional)
    • ts - Unix timestamp (in seconds) to override creation time (optional)
    • url - manufacturer url (optional)
    • version - font version string, can be Version x.y or x.y.
  • buf - internal byte buffer object, similar to DataView. It's buffer property is Uin8Array or Array with ttf content.

Example:

var fs = require('fs');
var svg2ttf = require('svg2ttf');

var ttf = svg2ttf(fs.readFileSync('myfont.svg', 'utf8'), {});
fs.writeFileSync('myfont.ttf', new Buffer(ttf.buffer));

svg2ttf for enterprise

Available as part of the Tidelift Subscription.

The maintainers of svg2ttf and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

More Repositories

1

fontello

Iconic fonts scissors
JavaScript
6,972
star
2

svgpath

SVG path low level transformations toolkit
JavaScript
540
star
3

ttf2woff

Font convertor, TTF to WOFF, for node.js
JavaScript
345
star
4

brandico.font

Font with logos of social services & messagers
HTML
298
star
5

fontelico.font

Opensource iconic font from Fontello project
CSS
180
star
6

ttf2eot

Font convertor, TTF to EOT, for node.js
JavaScript
139
star
7

font-builder

Set of script to build & transform iconic fonts
C++
122
star
8

wawoff2

WebAssembly build of Google's woff2
JavaScript
72
star
9

svg-font-create

Create SVG font from separate images
JavaScript
69
star
10

cubic2quad

Aproximates cubic bezier curves with quadratic ones.
JavaScript
34
star
11

linecons.font

Transformed Linecons font
CSS
25
star
12

svg-font-dump

Dump svg font to separate images
JavaScript
25
star
13

typicons.font

transformed Typicons
CSS
23
star
14

awesome-uni.font

transformed Font Awesome
HTML
16
star
15

zocial.font

Zocial icons, prepared for fontello
CSS
16
star
16

websymbols-uni.font

transformed WebSymbols font
Makefile
11
star
17

meteocons.font

Meteocons icons, prepared for fontello
CSS
10
star
18

maki.font

Maki icons, prepared for fontell
HTML
7
star
19

modernpics.font

transformed Modern Pictograms
HTML
6
star
20

iconic-uni.font

merged/transformed Iconic Stroke & Iconic Fill
C
5
star
21

weathercons.font

transformed Weather Icons
CSS
4
star
22

elusive.font

transformed Elusive Icons font
CSS
4
star
23

microbuffer

Light implementation of binary buffer with helpers for easy access.
JavaScript
3
star
24

fontello-design

New Fontello design
2
star
25

mfglabs.font

transformed MFG Labs font
CSS
1
star