New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.0.6 to 1.0.7

6

HISTORY.md

@@ -0,1 +1,7 @@

1.0.7 / 2013-09-22
------------------
- Improved speed x2.5 times
1.0.6 / 2013-09-12

@@ -2,0 +8,0 @@ ------------------

42

lib/math.js
'use strict';
function Point(x, y) {
if (!(this instanceof Point)) {
return new Point(x, y);
}
this.x = x;
this.y = y;
}
this.add = function (point) {
return new Point(this.x + point.x, this.y + point.y);
};
Point.prototype.add = function (point) {
return new Point(this.x + point.x, this.y + point.y);
};
this.sub = function (point) {
return new Point(this.x - point.x, this.y - point.y);
};
Point.prototype.sub = function (point) {
return new Point(this.x - point.x, this.y - point.y);
};
this.mul = function (value) {
return new Point(this.x * value, this.y * value);
};
Point.prototype.mul = function (value) {
return new Point(this.x * value, this.y * value);
};
this.div = function (value) {
return new Point(this.x / value, this.y / value);
};
Point.prototype.div = function (value) {
return new Point(this.x / value, this.y / value);
};
this.dist = function () {
return Math.sqrt(this.x*this.x + this.y*this.y);
};
Point.prototype.dist = function () {
return Math.sqrt(this.x*this.x + this.y*this.y);
};
this.sqr = function () {
return this.x*this.x + this.y*this.y;
};
}
Point.prototype.sqr = function () {
return this.x*this.x + this.y*this.y;
};

@@ -36,0 +32,0 @@

@@ -246,64 +246,64 @@ 'use strict';

this.width = 0;
};
Object.defineProperty(this, 'xMin', {
get: function () {
var xMin = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
xMin = Math.min(xMin, Math.floor(point.x));
hasPoints = true;
});
Object.defineProperty(Glyph.prototype, 'xMin', {
get: function () {
var xMin = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
xMin = Math.min(xMin, Math.floor(point.x));
hasPoints = true;
});
return hasPoints ? xMin : 0;
}
});
Object.defineProperty(this, 'xMax', {
get: function () {
var xMax = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
xMax = Math.max(xMax, -Math.floor(-point.x));
hasPoints = true;
});
});
return hasPoints ? xMin : 0;
}
});
Object.defineProperty(Glyph.prototype, 'xMax', {
get: function () {
var xMax = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
xMax = Math.max(xMax, -Math.floor(-point.x));
hasPoints = true;
});
return hasPoints ? xMax : 0;
}
});
Object.defineProperty(this, 'yMin', {
get: function () {
var yMin = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
yMin = Math.min(yMin, Math.floor(point.y));
hasPoints = true;
});
});
return hasPoints ? xMax : 0;
}
});
Object.defineProperty(Glyph.prototype, 'yMin', {
get: function () {
var yMin = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
yMin = Math.min(yMin, Math.floor(point.y));
hasPoints = true;
});
return hasPoints ? yMin : 0;
}
});
Object.defineProperty(this, 'yMax', {
get: function () {
var yMax = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
yMax = Math.max(yMax, -Math.floor(-point.y));
hasPoints = true;
});
});
return hasPoints ? yMin : 0;
}
});
Object.defineProperty(Glyph.prototype, 'yMax', {
get: function () {
var yMax = 0;
var hasPoints = false;
_.forEach(this.contours, function (contour) {
_.forEach(contour.points, function (point) {
yMax = Math.max(yMax, -Math.floor(-point.y));
hasPoints = true;
});
return hasPoints ? yMax : 0;
}
});
};
});
return hasPoints ? yMax : 0;
}
});
var Contour = function () {

@@ -310,0 +310,0 @@ this.points = [];

@@ -14,2 +14,3 @@ // Converts SVG contours,

var prevCommand = contour[contour.length - 1];
var Point = math.Point;

@@ -20,6 +21,6 @@ _.forEach(contour, function (command) {

var quadCurves = math.bezierCubicToQuad(
math.Point(prevCommand.x, prevCommand.y),
math.Point(command.x1, command.y1),
math.Point(command.x2, command.y2),
math.Point(command.x, command.y),
new Point(prevCommand.x, prevCommand.y),
new Point(command.x1, command.y1),
new Point(command.x2, command.y2),
new Point(command.x, command.y),
accuracy

@@ -33,3 +34,3 @@ );

else {
resContour.push(_.cloneDeep(command));
resContour.push(command);
}

@@ -36,0 +37,0 @@

@@ -77,9 +77,9 @@ 'use strict';

return _.map(contours, function (contour) {
var resContour = _.cloneDeep(contour);
if (resContour.length > 1 &&
resContour[0].x === resContour[resContour.length - 1].x &&
resContour[0].y === resContour[resContour.length - 1].y) {
resContour.splice(resContour.length - 1);
var length = contour.length;
if (length > 1 &&
contour[0].x === contour[length - 1].x &&
contour[0].y === contour[length - 1].y) {
contour.splice(length - 1);
}
return resContour;
return contour;
});

@@ -86,0 +86,0 @@ }

{
"name" : "svg2ttf",
"version" : "1.0.6",
"version" : "1.0.7",

@@ -6,0 +6,0 @@ "description" : "Convert SVG graphics to TTF font",

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