svgicons2svgfont
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "svgicons2svgfont", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Read a set of SVG icons and ouput a SVG font", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/nfroidure/svgicons2svgfont", |
@@ -38,8 +38,12 @@ /* | ||
if('svg' === tag.name) { | ||
if('width' in tag.attributes) { | ||
glyph.width = parseFloat(tag.attributes.width, 10); | ||
} | ||
if('height' in tag.attributes) { | ||
glyph.height = parseFloat(tag.attributes.height, 10); | ||
} | ||
if('width' in tag.attributes) { | ||
glyph.width = parseFloat(tag.attributes.width, 10); | ||
} | ||
if('height' in tag.attributes) { | ||
glyph.height = parseFloat(tag.attributes.height, 10); | ||
} | ||
// Clipping path unsupported | ||
} else if('clipPath' === tag.name) { | ||
log('Found a clipPath element in the icon "' + glyph.name + '" the result' | ||
+' may be different than expected.'); | ||
// Change rect elements to the corresponding path | ||
@@ -49,4 +53,4 @@ } else if('rect' === tag.name) { | ||
// Move to the left corner | ||
'M' + parseFloat(tag.attributes.x,10).toString(10) | ||
+ ' ' + parseFloat(tag.attributes.y,10).toString(10) | ||
'M' + parseFloat(tag.attributes.x || 0,10).toString(10) | ||
+ ' ' + parseFloat(tag.attributes.y || 0,10).toString(10) | ||
// Draw the rectangle | ||
@@ -141,2 +145,3 @@ + 'h' + parseFloat(tag.attributes.width, 10).toString(10) | ||
var d = ''; | ||
glyph.d.forEach(function(cD) { | ||
@@ -143,0 +148,0 @@ d+=' '+new SVGPathData(cD).ySymetry(glyph.height).encode(); |
@@ -104,2 +104,8 @@ var assert = require('assert') | ||
it.only("should work with real world icons", function(done) { | ||
generateFontToFile({ | ||
fontName: 'realicons' | ||
}, done); | ||
}); | ||
}); | ||
@@ -106,0 +112,0 @@ |
66177
51
383