Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
svg-text-to-vector
Advanced tools
A powerful tool for runtime text to vector conversion of complex SVG files.
- Supported Tags: 'text | tspan'.
- Attributes: Supports all major attributes including x, y, dx, dy, opacity, stroke, transform, class-based styling etc.
- Colors: Supports Solid Fill, Linear and Radial Gradients.
- Dynamic Font Handling: Offers dynamic runtime addition of fonts to its native config/fonts.json file.
npm install --save svg-text-to-vector
const ConvertToPath = require('svg-text-to-vector');
var svgTextPath = require('svg-text-to-vector');
var options={
load:'file.svg',
save:'file-convert.svg'
}
const convert = await svgTextPath.getPath(options);
var svg = fs.readFileSync('./public/file.svg');
svg=Buffer.from(svg);
var options={
load:svg,
save:'buffer'
}
const convert = await ConvertToPath.getPath(options);
var svg = fs.readFileSync('./public/file.svg','base64');
var options={
load:svg,
save:'base64'
}
const convert = await ConvertToPath.getPath(options);
var svg = fs.readFileSync('./public/file.svg',{encoding:'utf8'});
var options={
load:svg,
save:'utf8' | 'utf-8'
}
const convert = await ConvertToPath.getPath(options);
var font={"name":"Lexend Tera","path": "/lexend_tera.ttf"};
const addFonts = await ConvertToPath.push(font);
{
"font":[
{
"name":"Times New Roman",
"path":"./public/fonts/times.ttf"
},
{
"name":"Anton",
"path":"./public/fonts/anton.ttf"
}
]
}
Params | Data Type | Description |
---|---|---|
options.load | {String - Buffer - Base64 - UTF-8} | Contains SVG object that needs to be converted. Loads from a Local Directory or from type Buffer - Base64 - SVG String |
options.save | {String} | Returns the convert to path SVG object. Saves to a Local Directory or returns type Buffer - Base64 - SVG String |
options.font | {String} | Optional - Param for default font. Applicable if unable to find the relevant font. Default is Times New Roman |
options.fontPath | {String} | Optional - Param for default font path. Applicable if unable to find relevant fonts and options.font param is defined. Default is svg-text-to-vector/config/fonts/times.ttf |
options.fontSize | {Number} | Optional - Param for default font size. Applicable if no font size is defined within SVG text tag. Default is 16 |
The package ensures fast and efficient performance and is fully compatible with all the popular Node.js frameworks.
MIT
The paid version, SVG Convert to Path performs runtime path conversion of both svg shapes & text tags.
Complete list of features include:
- Supported Tags: 'text | tspan | rect | circle | ellipse | line | polyline | polygon'.
- Attributes: Supports all major attributes including x, y, dx, dy, opacity, stroke, transform, class-based styling etc.
- Colors: Supports Solid Fill, Linear and Radial Gradients.
- Multilingual Support: Supports all Languages & Unicode characters.
- Dynamic Font Handling: Offers dynamic runtime addition of fonts to its native config/fonts.json file.
- Google Fonts: In case of a missing font, the code will search for the required font from Google Fonts Github. On failure, applies font from default settings. You may change the default font & font size settings from the source code files.
- Multilingual Font Handling: In order for all Languages and Unicode characters to render correctly, you simply need to download Arial Unicode MS font and save it to svg-convert-to-path/config/fonts location as arial-unicode-ms.ttf. (Click here to download the font)
- Built-in Common Fonts: 'Helvetica | Arial | Verdana | Tahoma | Trebuchet MS | Impact | Times New Roman | Courier | Comic Sans MS'.
FAQs
Converts textfield tags in an SVG file to vector paths.
The npm package svg-text-to-vector receives a total of 17 weekly downloads. As such, svg-text-to-vector popularity was classified as not popular.
We found that svg-text-to-vector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.