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

svgicons2svgfont

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svgicons2svgfont - npm Package Compare versions

Comparing version 3.2.1 to 4.0.0

tests/expected/test-codepoint.json

7

package.json
{
"name": "svgicons2svgfont",
"version": "3.2.1",
"version": "4.0.0",
"description": "Read a set of SVG icons and ouput a SVG font",

@@ -31,4 +31,5 @@ "homepage": "https://github.com/nfroidure/svgicons2svgfont",

"commander": "^2.9.0",
"neatequal": "^1.0.0",
"readable-stream": "^2.0.4",
"sax": "^1.1.4",
"sax": "^1.1.5",
"string.fromcodepoint": "^0.2.1",

@@ -41,3 +42,3 @@ "string.prototype.codepointat": "^0.2.0",

"eslint": "^1.10.0",
"eslint-config-simplifield": "^1.1.0",
"eslint-config-simplifield": "^1.2.2",
"istanbul": "^0.4.0",

@@ -44,0 +45,0 @@ "mocha": "^2.3.4",

@@ -6,2 +6,3 @@ 'use strict';

var fileSorter = require('./filesorter');
var initMetadataService = require('../src/metadata');

@@ -17,4 +18,4 @@ var Readable = require('stream').Readable;

function SVGIconsDirStream(dir, options) {
var getMetadata = require('../src/metadata')(options);
var _this = this;
var getMetadata = initMetadataService(options);
var filesInfos;

@@ -21,0 +22,0 @@ var gotFilesInfos = false;

@@ -68,2 +68,35 @@ /* eslint no-multi-str:0 */

// According to the document (http://www.w3.org/TR/SVG/painting.html#FillProperties)
// fill <paint> none|currentColor|inherit|<color>
// [<icccolor>]|<funciri> (not support yet)
function getTagColor(currTag, parents) {
var defaultColor = 'black';
var fillVal = currTag.attributes.fill;
var color;
var parentsLength = parents.length;
if('none' === fillVal) {
return color;
}
if('currentColor' === fillVal) {
return defaultColor;
}
if('inherit' === fillVal) {
if(0 === parentsLength) {
return defaultColor;
}
return getTagColor(
parents[parentsLength - 1],
parents.slice(0, parentsLength - 1)
);
// this might be null.
// For example: <svg ><path fill="inherit" /> </svg>
// in this case getTagColor should return null
// recursive call, the bottom element should be svg,
// and svg didn't fill color, so just return null
}
return fillVal;
}
// Inherit of duplex stream

@@ -147,2 +180,3 @@ util.inherits(SVGIcons2SVGFontStream, Stream.Transform);

var values;
var color;

@@ -203,2 +237,11 @@ parents.push(tag);

}
// According to http://www.w3.org/TR/SVG/painting.html#SpecifyingPaint
// Map attribute fill to color property
if('none' !== tag.attributes.fill) {
color = getTagColor(tag, parents);
if('undefined' !== typeof color) {
glyph.color = color;
}
}
} catch(err) {

@@ -205,0 +248,0 @@ _this.emit('error', new Error('Got an error parsing the glyph' +

@@ -6,2 +6,3 @@ 'use strict';

var assert = require('assert');
var childProcess = require('child_process');

@@ -17,3 +18,3 @@ describe('Testing CLI', function() {

(require('child_process').exec)(
(childProcess.exec)(
command,

@@ -53,3 +54,3 @@ function(err) {

(require('child_process').exec)(
(childProcess.exec)(
command,

@@ -83,3 +84,3 @@ function(err) {

(require('child_process').exec)(
(childProcess.exec)(
command,

@@ -86,0 +87,0 @@ function(err) {

@@ -6,2 +6,3 @@ 'use strict';

var path = require('path');
var ucs2 = require('punycode').ucs2;

@@ -13,2 +14,5 @@ var svgicons2svgfont = require('../src/index.js');

var neatequal = require('neatequal');
var codepoint = require('./expected/test-codepoint.json');
// Helpers

@@ -49,2 +53,8 @@ function generateFontToFile(options, done, fileSuffix, startUnicode, files) { // eslint-disable-line

options.log = function() {};
options.callback = function(glyphs) {
var fontName = options.fontName;
neatequal(glyphs, codepoint[fontName]);
};
svgFontStream = svgicons2svgfont(options);

@@ -418,4 +428,2 @@

it('should work with high code points', function(done) {
var ucs2 = require('punycode').ucs2;
var svgIconStream = fs.createReadStream(

@@ -422,0 +430,0 @@ path.join(__dirname, 'fixtures', 'cleanicons', 'account.svg')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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