jsr-text-to-svg
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i jsr-text-to-svg

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

7.67 kB

Total Files

7

Last publish

Collaborators

  • visados.frontend