1.0.0 • Published 3 years ago

jsr-text-to-svg v1.0.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
3 years ago

String 2 SVG

This code replace text with an SVG representation of itself.

It's based on these codes:

Peer dependencies

Usage

  • Install package with
npm i string-to-svg
  • Import this module via JS.
import StringToSVG from '@npm_leadtech/jsr-text-to-svg';
  • Call the init method
new StringToSVG([options]);

How do I customize things?

You can set the config or font after initialization by setting these properties:

  • config Set config options.
  • font Set font loaded. Must be in a valid OpenType or TrueType format.

By default config options are:

{
    font: undefined, // MUST BE ALWAYS PROVIDED.
    fontSize: 16,
    decimals: 1,
    singleGylyphs: false, // Glyphs will be individual Paths if True, otherwise will merge everything into the same path.
    options: {
        letterSpacing: 0,
        lineHeight: 1
    }
};

To-Do

  • Write/Read SVG files to avoid on-the-fly conversion everytime.
  • Add TS.
1.0.0

3 years ago