Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg2ttf

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg2ttf - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

5.1.0 / 2020-10-29
------------------
- Added support of `d` attr in nested `<path>` tag (for UNSCII font source).
5.0.0 / 2020-05-20

@@ -2,0 +9,0 @@ ------------------

23

lib/svg.js

@@ -5,9 +5,26 @@ 'use strict';

var cubic2quad = require('cubic2quad');
var svgpath = require('svgpath');
var DOMParser = require('xmldom').DOMParser;
var ucs2 = require('./ucs2');
function getGlyph(glyphElem) {
function getGlyph(glyphElem, fontInfo) {
var glyph = {};
glyph.d = glyphElem.getAttribute('d').trim();
if (glyphElem.hasAttribute('d')) {
glyph.d = glyphElem.getAttribute('d').trim();
} else {
// try nested <path>
var pathElem = glyphElem.getElementsByTagName('path')[0];
if (pathElem.hasAttribute('d')) {
// <path> has reversed Y axis
glyph.d = svgpath(pathElem.getAttribute('d'))
.scale(1, -1)
.translate(0, fontInfo.ascent)
.toString();
} else {
throw new Error("Can't find 'd' attribute of <glyph> tag.");
}
}
glyph.unicode = [];

@@ -142,3 +159,3 @@

_.forEach(fontElem.getElementsByTagName('glyph'), function (glyphElem) {
var glyph = getGlyph(glyphElem);
var glyph = getGlyph(glyphElem, font);

@@ -145,0 +162,0 @@ if (_.has(glyph, 'ligature')) {

2

package.json
{
"name": "svg2ttf",
"version": "5.0.0",
"version": "5.1.0",
"description": "Converts SVG font to TTF font",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc