Convert svg nodes to vector font-free elements.
Features:
- supports
<tspan>; - supports multiple values of attributes
x,y,dx,dy; - supports CSS
text-anchoranddominant-baselineproperties; - supports
textLengthandlengthAdjust; - supports css units (em, rem, %, mm, cm, in, pt, pc, ...);
- supports variable fonts (include custom axis via
font-variation-settings); - supports open type features via css
font-feature-settings(liga,smcpand another) - supports otf/ttf/woff/woff2 fonts;
- integrated with Google Fonts;
- supports various font sources: config,
@font-face, directory, http-repository or your own handler; - supports nodejs and browser runtime;
- detailed statistics.
Install in project:
npm i svg-text-to-path --saveInstall globally (i. e. using CLI-interface from anywhere):
npm i -g svg-text-to-pathsvg-text-to-path [options] [input file]Support pipes:
cat in.svg | svg-text-to-path [options] >out.svgYou can see the list of options by typing:
svg-text-to-path --helpImport required class from library:
import Session from 'svg-text-to-path';
let session = new Session(svg, {
googleApiKey: '...',
});
let stat = await session.replaceAll();
let out = session.getSvgString();Or include dist/svg-text-to-path-fontkit.js and use window.SvgTextToPath object:
let session = new SvgTextToPath(document.querySelector('svg'), {
googleApiKey: '...',
});
let stat = await session.replaceAll();Start server:
svg-text-to-path-server [configFile]Config file is the same as for the cli.
Post svg-file to http://{host}:{port}/?params, get processed svg in response body.
Statistics in X-Svg-Text-To-Path header (if stat parameter enabled).
Default port: 10000.
Curl example:
curl --header "Content-Type: image/svg+xml" \
--request POST \
--data-binary "@input.svg" \
http://localhost:10000/?googleApiKey=...&stat=1Send me a donation for project development: