0.2.2 • Published 9 months ago

@marmooo/ttf2svg v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@marmooo/ttf2svg

Convert TTF to SVG.

Installation

Deno

deno install -fr -R -g npm:@marmooo/ttf2svg

Node

npm install @marmooo/ttf2svg -g

Usage

import { ttf2svg, ttf2svgFont } from "@marmooo/ttf2svg";

const font = Deno.readFileSync("font.ttf");
ttf2svg(font);
ttf2svg(font, { text: "abcdef", width: 100 });
ttf2svg(font, { code: "0x61,98" });
ttf2svgFont(font);
ttf2svgFont(font, { codeFile: "codepoints.lst" });

CLI

Usage: ttf2svg [options] <fontPath>

Convert TTF to SVG.

Arguments:
  fontPath                 Font path (.otf, .ttf, .woff)

Options:
  -V, --version            output the version number
  --text <string>          characters to compress
  --text-file <path>       Path of line separated character file to compress
  --code <string>          comma separated codepoints to compress
  --code-file <path>       Path of line separated codepoint file to compress
  --name <string>          comma separated glyph names to compress
  --name-file <path>       Path of line separated glyph name file to compress
  --ligature <string>      comma separated ligatures to compress
  --ligature-file <path>   Path of line separated ligature file to compress
  --font                   output as SVG font
  --width <string>         SVG width attribute value
  --height <string>        SVG height attribute value
  --glyph-height <number>  Glyph height when outputting as SVG
  --translate-y <number>   Glyph translateY when outputting as SVG
  --remove-notdef          remove .notdef
  --remove-ligatures       remove ligatures associated with the glyphs
  -h, --help               display help for command

Examples

ttf2svg font.ttf > list.html
ttf2svg font.woff --font > font.svg
ttf2svg font.otf --text abcdef --translate-y 850 > abcdef.svg
ttf2svg font.otf --text-file characters.lst --font > font.svg
ttf2svg font.woff2 --code 0x61,98 > font.html
ttf2svg font.woff2 --name alarm,box --font > font.svg
ttf2svg font.woff2 --ligature home,menu --font > font.svg

License

MIT

0.2.2

9 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago