Comparing version 5.0.0 to 5.1.0
@@ -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 @@ ------------------ |
@@ -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')) { |
{ | ||
"name": "svg2ttf", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Converts SVG font to TTF font", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80291
2149